You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2026/04/03 18:36:50 UTC
(camel-karavan) 06/18: Folder Structure Refactoring
This is an automated email from the ASF dual-hosted git repository.
marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
commit e9774bb2a443084a6264fab1b53ba1fd652e7bc2
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Fri Apr 3 12:09:07 2026 -0400
Folder Structure Refactoring
---
.../api/CamelDefinitionApi.ts | 11 -
.../api/CamelDefinitionApiExt.ts | 0
.../api/CamelDefinitionYaml.ts | 0
.../api/CamelDefinitionYamlStep.ts | 9 -
.../{karavan-core => core}/api/CamelDisplayUtil.ts | 17 +-
.../src/{karavan-core => core}/api/CamelUtil.ts | 4 +-
.../src/{karavan-core => core}/api/ComponentApi.ts | 6 +-
.../src/{karavan-core => core}/api/KameletApi.ts | 0
.../api/MainConfigurationApi.ts | 0
.../{karavan-core => core}/api/ProjectModelApi.ts | 0
.../src/{karavan-core => core}/api/SpiBeanApi.ts | 0
.../src/{karavan-core => core}/api/TemplateApi.ts | 0
.../{karavan-core => core}/api/TopologyUtils.ts | 55 +-
.../src/{karavan-core => core}/api/VariableUtil.ts | 0
.../webui/src/{karavan-core => core}/contants.ts | 5 +-
.../model/CamelDefinition.ts | 15 +-
.../{karavan-core => core}/model/CamelMetadata.ts | 157 +-
.../model/ComponentModels.ts | 0
.../model/IntegrationDefinition.ts | 0
.../{karavan-core => core}/model/KameletModels.ts | 0
.../model/MainConfigurationModel.ts | 0
.../{karavan-core => core}/model/ProjectModel.ts | 0
.../{karavan-core => core}/model/SpiBeanModels.ts | 0
.../model/TopologyDefinition.ts | 8 +-
.../src/main/webui/src/karavan/api/AccessApi.tsx | 194 ---
.../src/main/webui/src/karavan/api/KaravanApi.tsx | 764 --------
.../src/main/webui/src/karavan/api/LogWatchApi.tsx | 68 -
.../main/webui/src/karavan/api/NotificationApi.tsx | 96 -
.../src/main/webui/src/karavan/api/SearchApi.tsx | 26 -
.../src/main/webui/src/karavan/api/SystemApi.tsx | 194 ---
.../main/webui/src/karavan/api/auth/AuthApi.tsx | 239 ---
.../webui/src/karavan/api/auth/AuthProvider.tsx | 102 --
.../src/main/webui/src/karavan/api/auth/SsoApi.tsx | 64 -
karavan-app/src/main/webui/src/karavan/app/App.css | 20 -
karavan-app/src/main/webui/src/karavan/app/App.tsx | 99 --
.../src/main/webui/src/karavan/app/MainHook.tsx | 149 --
.../main/webui/src/karavan/app/ReadinessPanel.tsx | 89 -
.../main/webui/src/karavan/app/login/LoginPage.css | 333 ----
.../main/webui/src/karavan/app/login/LoginPage.tsx | 214 ---
.../webui/src/karavan/app/login/OrbitLines.tsx | 68 -
.../webui/src/karavan/app/login/UserPopupOidc.tsx | 50 -
.../src/karavan/app/navigation/MainRoutes.tsx | 85 -
.../src/karavan/app/navigation/NavigationMenu.tsx | 64 -
.../karavan/app/navigation/NotAuthorizedPage.tsx | 42 -
.../src/karavan/app/navigation/PageNavigation.css | 191 --
.../src/karavan/app/navigation/PageNavigation.tsx | 131 --
.../src/karavan/app/navigation/PlatformLogo.tsx | 28 -
.../karavan/app/navigation/ProjectFunctionHook.tsx | 273 ---
.../src/karavan/app/navigation/ProtectedRoute.tsx | 25 -
.../webui/src/karavan/app/navigation/Routes.ts | 31 -
.../webui/src/karavan/app/theme/DarkModeToggle.tsx | 44 -
.../webui/src/karavan/app/theme/ThemeContext.tsx | 66 -
.../main/webui/src/karavan/bus/ErrorEventBus.ts | 25 -
.../main/webui/src/karavan/bus/ProjectEventBus.ts | 25 -
.../src/karavan/features/access/AccessPage.tsx | 140 --
.../karavan/features/access/roles/RoleModal.tsx | 130 --
.../karavan/features/access/roles/RolesTable.tsx | 75 -
.../features/access/roles/RolesTableRow.tsx | 111 --
.../features/access/users/ChangePassword.tsx | 121 --
.../features/access/users/PasswordModal.tsx | 158 --
.../karavan/features/access/users/UserModal.tsx | 174 --
.../karavan/features/access/users/UserProfile.tsx | 124 --
.../features/access/users/UserProfileTab.tsx | 29 -
.../karavan/features/access/users/UsersTable.tsx | 77 -
.../features/access/users/UsersTableRow.tsx | 205 ---
.../features/documentation/Documentation.css | 131 --
.../features/documentation/DocumentationPage.tsx | 172 --
.../documentation/components/ComponentCard.tsx | 66 -
.../documentation/components/ComponentModal.tsx | 160 --
.../documentation/components/ComponentsTab.tsx | 46 -
.../karavan/features/documentation/eip/EipCard.tsx | 59 -
.../features/documentation/eip/EipModal.tsx | 95 -
.../karavan/features/documentation/eip/EipTab.tsx | 47 -
.../documentation/kamelets/KameletCard.tsx | 68 -
.../documentation/kamelets/KameletModal.tsx | 87 -
.../documentation/kamelets/KameletsTab.tsx | 47 -
.../karavan/features/project/ContainerLogTab.tsx | 81 -
.../karavan/features/project/DesignerToggle.tsx | 56 -
.../features/project/FileSearchToolbarItem.tsx | 53 -
.../features/project/ImageDownloadToolbar.tsx | 61 -
.../src/karavan/features/project/Project.types.ts | 19 -
.../project/ProjectContainerContextToolbar.tsx | 67 -
.../project/ProjectContainersContextProvider.tsx | 82 -
.../karavan/features/project/ProjectContext.tsx | 29 -
.../src/karavan/features/project/ProjectPage.css | 304 ----
.../src/karavan/features/project/ProjectPage.tsx | 107 --
.../features/project/ProjectPageNavigation.tsx | 179 --
.../src/karavan/features/project/ProjectPanel.tsx | 86 -
.../src/karavan/features/project/ProjectTitle.tsx | 69 -
.../karavan/features/project/RenameFileModal.tsx | 110 --
.../features/project/beans/BeanFilesDropdown.tsx | 78 -
.../karavan/features/project/beans/BeanWizard.tsx | 241 ---
.../karavan/features/project/designer/CodeStore.ts | 14 -
.../features/project/designer/DesignerStore.ts | 386 -----
.../project/designer/ErrorBoundaryWrapper.tsx | 35 -
.../features/project/designer/KaravanDesigner.css | 33 -
.../features/project/designer/KaravanDesigner.tsx | 207 ---
.../project/designer/KaravanDesignerViewSwitch.tsx | 45 -
.../features/project/designer/beans/BeanCard.tsx | 61 -
.../project/designer/beans/BeansDesigner.tsx | 115 --
.../features/project/designer/beans/bean.css | 102 --
.../project/designer/icons/ComponentIcons.tsx | 1833 --------------------
.../features/project/designer/icons/EipIcons.tsx | 293 ----
.../project/designer/icons/KaravanIcons.tsx | 721 --------
.../features/project/designer/icons/OtherIcons.tsx | 36 -
.../designer/kamelet/KameletAnnotationsPanel.tsx | 84 -
.../kamelet/KameletDefinitionPropertyCard.tsx | 299 ----
.../designer/kamelet/KameletDefinitionsPanel.tsx | 126 --
.../designer/kamelet/KameletDependenciesCard.tsx | 105 --
.../project/designer/kamelet/KameletDesigner.tsx | 33 -
.../project/designer/kamelet/KameletInput.tsx | 139 --
.../designer/kamelet/KameletTypesOutCard.tsx | 105 --
.../features/project/designer/kamelet/kamelet.css | 48 -
.../karavan/features/project/designer/karavan.css | 456 -----
.../project/designer/property/DslProperties.css | 406 -----
.../project/designer/property/DslProperties.tsx | 268 ---
.../designer/property/MainPropertiesPanel.tsx | 66 -
.../project/designer/property/PropertiesHeader.tsx | 358 ----
.../project/designer/property/PropertyStore.ts | 50 -
.../property/expression/ExpressionBottomPanel.tsx | 80 -
.../property/expression/ExpressionContextModel.tsx | 193 ---
.../property/expression/ExpressionEditor.css | 75 -
.../property/expression/ExpressionEditor.tsx | 80 -
.../designer/property/property/BeanProperties.css | 39 -
.../designer/property/property/BeanProperties.tsx | 345 ----
.../property/property/ComponentPropertyField.css | 47 -
.../property/property/ComponentPropertyField.tsx | 513 ------
.../property/ConfigurationSelectorModal.css | 19 -
.../property/ConfigurationSelectorModal.tsx | 366 ----
.../designer/property/property/DataFormatField.tsx | 161 --
.../property/property/DslPropertyField.css | 55 -
.../property/property/DslPropertyField.tsx | 1057 -----------
.../property/property/DslPropertyFieldSelect.tsx | 81 -
.../property/DslPropertyFieldSelectScrollable.tsx | 126 --
.../designer/property/property/ExpressionField.tsx | 182 --
.../property/property/FileReferenceDropdown.css | 48 -
.../property/property/FileReferenceDropdown.tsx | 293 ----
.../property/property/KameletPropertyField.css | 47 -
.../property/property/KameletPropertyField.tsx | 293 ----
.../designer/property/property/ObjectField.tsx | 89 -
.../property/PropertyPlaceholderDropdown.css | 42 -
.../property/PropertyPlaceholderDropdown.tsx | 196 ---
.../designer/property/property/PropertyUtil.tsx | 42 -
.../property/property/VariablesDropdown.css | 37 -
.../property/property/VariablesDropdown.tsx | 301 ----
.../designer/property/usePropertiesHook.tsx | 246 ---
.../features/project/designer/rest/RestCard.tsx | 109 --
.../designer/rest/RestConfigurationCard.tsx | 60 -
.../project/designer/rest/RestDesigner.tsx | 225 ---
.../project/designer/rest/RestMethodCard.tsx | 68 -
.../project/designer/rest/RestMethodSelector.tsx | 66 -
.../features/project/designer/rest/rest.css | 286 ---
.../project/designer/route/DeleteConfirmation.tsx | 48 -
.../project/designer/route/DslConnections.css | 124 --
.../project/designer/route/DslConnections.tsx | 509 ------
.../project/designer/route/RouteDesigner.css | 164 --
.../project/designer/route/RouteDesigner.tsx | 195 ---
.../project/designer/route/element/DslElement.css | 322 ----
.../project/designer/route/element/DslElement.tsx | 330 ----
.../designer/route/element/DslElementHeader.tsx | 449 -----
.../designer/route/element/DslElementMoveModal.tsx | 89 -
.../route/element/RouteTemplateElement.css | 52 -
.../route/element/RouteTemplateElement.tsx | 106 --
.../project/designer/route/useResizeObserver.tsx | 40 -
.../designer/route/useRouteDesignerHook.tsx | 386 -----
.../features/project/designer/selector/DslCard.tsx | 110 --
.../project/designer/selector/DslFastCard.tsx | 53 -
.../project/designer/selector/DslPreferences.tsx | 89 -
.../project/designer/selector/DslSelector.css | 218 ---
.../project/designer/selector/DslSelector.tsx | 426 -----
.../designer/utils/CamelDefaultStepProperty.tsx | 38 -
.../features/project/designer/utils/CamelUi.tsx | 1056 -----------
.../project/designer/utils/DslMetaModel.ts | 83 -
.../project/designer/utils/ElementIcon.css | 40 -
.../project/designer/utils/ElementIcons.tsx | 118 --
.../features/project/designer/utils/EventBus.ts | 126 --
.../project/designer/utils/InfrastructureAPI.ts | 71 -
.../project/designer/utils/IntegrationHeader.tsx | 44 -
.../features/project/designer/utils/MediaTypes.ts | 1525 ----------------
.../project/designer/utils/Notification.tsx | 56 -
.../project/designer/utils/ValidatorUtils.ts | 87 -
.../features/project/developer/CodeEditor.tsx | 63 -
.../features/project/developer/DataEditor.css | 39 -
.../features/project/developer/DesignerEditor.tsx | 134 --
.../features/project/developer/DeveloperEditor.tsx | 59 -
.../project/developer/DeveloperManager.css | 183 --
.../project/developer/DeveloperManager.tsx | 95 -
.../project/developer/DeveloperToolbar.tsx | 36 -
.../features/project/developer/EditorConfig.ts | 42 -
.../developer/EditorErrorBoundaryWrapper.tsx | 82 -
.../project/developer/EditorOverlayWidget.css | 12 -
.../project/developer/EditorOverlayWidget.tsx | 45 -
.../features/project/developer/EditorToolbar.tsx | 74 -
.../features/project/developer/MarkdownEditor.tsx | 72 -
.../project/developer/MonacoEditorWrapper.tsx | 215 ---
.../webui/src/karavan/features/project/devmode.css | 56 -
.../features/project/files/CreateFileModal.tsx | 128 --
.../features/project/files/CreateProjectModal.tsx | 185 --
.../features/project/files/DeleteFileModal.tsx | 67 -
.../features/project/files/DiffFileModal.css | 20 -
.../features/project/files/DiffFileModal.tsx | 136 --
.../features/project/files/FileCopyForEnvModal.tsx | 79 -
.../karavan/features/project/files/FilesSubTab.tsx | 408 -----
.../karavan/features/project/files/FilesTab.tsx | 476 -----
.../features/project/files/FilesTabUtils.tsx | 119 --
.../features/project/files/FilesToolbar.tsx | 244 ---
.../features/project/files/SourcesDrawerPanel.tsx | 19 -
.../karavan/features/project/files/SourcesTab.css | 22 -
.../karavan/features/project/files/SourcesTab.tsx | 35 -
.../features/project/files/UploadFileModal.tsx | 159 --
.../features/project/project-build/BuildTab.tsx | 32 -
.../project-containers/ContainerButtons.tsx | 149 --
.../ContainerEnvironmentPanel.tsx | 116 --
.../project/project-containers/ContainersTab.tsx | 25 -
.../project/project-containers/ContainersTable.tsx | 54 -
.../project-containers/ContainersTableRow.tsx | 73 -
.../project-containers/ContainersToolbar.tsx | 34 -
.../project-containers/DeploymentButtons.tsx | 164 --
.../project/project-containers/DeploymentPanel.tsx | 54 -
.../project/project-containers/ImagesPanel.tsx | 293 ----
.../project/project-pod/PodEventsLogTable.tsx | 61 -
.../features/project/project-pod/PodTab.tsx | 16 -
.../project-topology/CustomComponentFactory.tsx | 87 -
.../project/project-topology/CustomEdge.tsx | 40 -
.../project/project-topology/CustomGroup.tsx | 35 -
.../project/project-topology/CustomNode.tsx | 178 --
.../project/project-topology/GetCustomMenu.tsx | 67 -
.../project/project-topology/TopologyApi.tsx | 654 -------
.../project/project-topology/TopologyBeans.css | 52 -
.../project/project-topology/TopologyBeans.tsx | 77 -
.../project/project-topology/TopologyElkLayout.ts | 222 ---
.../project/project-topology/TopologyLegend.css | 68 -
.../project/project-topology/TopologyLegend.tsx | 38 -
.../project/project-topology/TopologyTab.tsx | 191 --
.../project/project-topology/TopologyToolbar.tsx | 102 --
.../features/project/project-topology/topology.css | 202 ---
.../project/project-topology/useTopologyHook.tsx | 128 --
.../karavan/features/project/readme/ReadmeTab.tsx | 31 -
.../features/project/toolbar/BuildToolbar.tsx | 185 --
.../features/project/toolbar/DevModeToolbar.css | 60 -
.../features/project/toolbar/DevModeToolbar.tsx | 164 --
.../features/project/toolbar/ProjectToolbar.tsx | 48 -
.../karavan/features/project/useProjectHook.tsx | 173 --
.../src/karavan/features/projects/Complexity.css | 42 -
.../karavan/features/projects/ComplexityApi.tsx | 40 -
.../karavan/features/projects/ComplexityModels.ts | 72 -
.../features/projects/CreateProjectModal.tsx | 150 --
.../features/projects/DeleteProjectModal.tsx | 69 -
.../features/projects/ProjectStatusLabel.tsx | 80 -
.../karavan/features/projects/ProjectZipApi.tsx | 39 -
.../src/karavan/features/projects/ProjectsPage.tsx | 88 -
.../src/karavan/features/projects/ProjectsTab.tsx | 146 --
.../karavan/features/projects/ProjectsTableRow.tsx | 117 --
.../features/projects/ProjectsTableRowActivity.tsx | 19 -
.../projects/ProjectsTableRowComplexity.tsx | 48 -
.../features/projects/ProjectsTableRowTimeLine.css | 43 -
.../features/projects/ProjectsTableRowTimeLine.tsx | 48 -
.../karavan/features/projects/ProjectsToolbar.tsx | 105 --
.../karavan/features/projects/SettingsToolbar.tsx | 58 -
.../features/projects/UploadProjectModal.tsx | 99 --
.../src/karavan/features/settings/SettingsPage.tsx | 110 --
.../src/karavan/features/system/SystemPage.tsx | 172 --
.../features/system/app-props/AppPropsRow.tsx | 49 -
.../features/system/app-props/AppPropsTable.tsx | 48 -
.../system/config-maps/ConfigMapKeyModal.tsx | 87 -
.../features/system/config-maps/ConfigMapModal.tsx | 87 -
.../features/system/config-maps/ConfigMapRow.tsx | 96 -
.../system/config-maps/ConfigMapRowKey.tsx | 97 --
.../system/config-maps/ConfigMapsTable.tsx | 71 -
.../features/system/containers/ContainerPage.css | 28 -
.../system/containers/ContainerTableRow.tsx | 213 ---
.../features/system/containers/ContainersTable.tsx | 98 --
.../system/deployments/DeploymentStatusRow.tsx | 50 -
.../system/deployments/DeploymentStatusesTable.tsx | 68 -
.../karavan/features/system/env-vars/EnvVarRow.tsx | 51 -
.../features/system/env-vars/EnvVarsTable.tsx | 48 -
.../features/system/secrets/SecretKeyModal.tsx | 88 -
.../features/system/secrets/SecretModal.tsx | 87 -
.../karavan/features/system/secrets/SecretRow.tsx | 105 --
.../features/system/secrets/SecretRowKey.tsx | 120 --
.../features/system/secrets/SecretsTable.tsx | 68 -
.../main/webui/src/karavan/models/AccessModels.ts | 54 -
.../main/webui/src/karavan/models/ProjectModels.ts | 282 ---
.../main/webui/src/karavan/models/SearchModels.ts | 21 -
.../main/webui/src/karavan/models/ServiceModels.ts | 70 -
.../main/webui/src/karavan/models/SystemModels.ts | 34 -
.../webui/src/karavan/services/AccessService.ts | 30 -
.../src/karavan/services/NotificationService.ts | 76 -
.../webui/src/karavan/services/ProjectService.ts | 347 ----
.../webui/src/karavan/services/SystemService.ts | 37 -
.../webui/src/karavan/shared/icons/SvgIcon.tsx | 28 -
.../src/karavan/shared/icons/SvgNavigationIcon.tsx | 19 -
.../main/webui/src/karavan/shared/icons/access.svg | 6 -
.../webui/src/karavan/shared/icons/application.svg | 13 -
.../main/webui/src/karavan/shared/icons/apps.svg | 72 -
.../main/webui/src/karavan/shared/icons/camel.svg | 69 -
.../main/webui/src/karavan/shared/icons/class.svg | 2 -
.../main/webui/src/karavan/shared/icons/config.svg | 2 -
.../src/karavan/shared/icons/container-run.svg | 11 -
.../webui/src/karavan/shared/icons/dashboard.svg | 6 -
.../webui/src/karavan/shared/icons/dashboardx.svg | 127 --
.../src/main/webui/src/karavan/shared/icons/db.svg | 2 -
.../src/karavan/shared/icons/dependencies.svg | 2 -
.../main/webui/src/karavan/shared/icons/docker.svg | 10 -
.../src/karavan/shared/icons/documentation.svg | 11 -
.../main/webui/src/karavan/shared/icons/git.svg | 2 -
.../main/webui/src/karavan/shared/icons/groovy.svg | 38 -
.../webui/src/karavan/shared/icons/groovy2.svg | 2 -
.../main/webui/src/karavan/shared/icons/icons.ts | 14 -
.../main/webui/src/karavan/shared/icons/ini.svg | 2 -
.../main/webui/src/karavan/shared/icons/jar.svg | 26 -
.../main/webui/src/karavan/shared/icons/jib.png | Bin 42246 -> 0 bytes
.../webui/src/karavan/shared/icons/jkube-logo.svg | 38 -
.../main/webui/src/karavan/shared/icons/jkube.svg | 41 -
.../main/webui/src/karavan/shared/icons/json.svg | 2 -
.../webui/src/karavan/shared/icons/light-db.svg | 2 -
.../webui/src/karavan/shared/icons/light-json.svg | 2 -
.../webui/src/karavan/shared/icons/light-yaml.svg | 2 -
.../main/webui/src/karavan/shared/icons/log.svg | 63 -
.../main/webui/src/karavan/shared/icons/logout.svg | 30 -
.../webui/src/karavan/shared/icons/markdown.svg | 2 -
.../main/webui/src/karavan/shared/icons/maven.svg | 2 -
.../webui/src/karavan/shared/icons/registry.svg | 2 -
.../webui/src/karavan/shared/icons/settings.svg | 28 -
.../main/webui/src/karavan/shared/icons/source.svg | 2 -
.../main/webui/src/karavan/shared/icons/sql.svg | 2 -
.../main/webui/src/karavan/shared/icons/text.svg | 2 -
.../main/webui/src/karavan/shared/icons/xml.svg | 2 -
.../main/webui/src/karavan/shared/icons/xsl.svg | 2 -
.../main/webui/src/karavan/shared/icons/yaml.svg | 2 -
.../main/webui/src/karavan/shared/monaco-setup.ts | 19 -
.../src/karavan/shared/polling/PollingManager.ts | 57 -
.../src/karavan/shared/polling/useDataPolling.ts | 40 -
.../src/karavan/shared/ui/ContainerButton.css | 34 -
.../src/karavan/shared/ui/ContainerButton.tsx | 72 -
.../src/karavan/shared/ui/ErrorBoundaryWrapper.tsx | 36 -
.../karavan/shared/ui/FieldSelectScrollable.tsx | 121 --
.../karavan/shared/ui/FieldSelectWithCreate.tsx | 256 ---
.../webui/src/karavan/shared/ui/MainToolbar.css | 514 ------
.../webui/src/karavan/shared/ui/MainToolbar.tsx | 43 -
.../src/karavan/shared/ui/ModalConfirmation.tsx | 77 -
.../webui/src/karavan/shared/ui/PlatformLogos.css | 37 -
.../webui/src/karavan/shared/ui/PlatformLogos.tsx | 66 -
.../webui/src/karavan/shared/ui/RightPanel.css | 33 -
.../webui/src/karavan/shared/ui/RightPanel.tsx | 29 -
.../main/webui/src/karavan/stores/AccessStore.ts | 67 -
.../src/karavan/stores/ContainerStatusesStore.ts | 48 -
.../webui/src/karavan/stores/DocumentationStore.ts | 57 -
.../src/main/webui/src/karavan/stores/LogStore.ts | 58 -
.../main/webui/src/karavan/stores/ProjectStore.ts | 438 -----
.../webui/src/karavan/stores/ReadinessStore.ts | 40 -
.../main/webui/src/karavan/stores/SearchStore.ts | 37 -
.../main/webui/src/karavan/stores/SettingsStore.ts | 88 -
.../main/webui/src/karavan/stores/SystemStore.ts | 67 -
.../main/webui/src/karavan/stores/TopologyStore.ts | 63 -
.../src/main/webui/src/karavan/util/CodeUtils.ts | 101 --
.../src/main/webui/src/karavan/util/ModalForm.css | 97 --
.../src/main/webui/src/karavan/util/StringUtils.ts | 341 ----
.../src/main/webui/src/karavan/util/form-util.css | 44 -
.../main/webui/src/karavan/util/useFormUtil.tsx | 328 ----
360 files changed, 121 insertions(+), 42384 deletions(-)
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/CamelDefinitionApi.ts b/karavan-app/src/main/webui/src/core/api/CamelDefinitionApi.ts
similarity index 99%
rename from karavan-app/src/main/webui/src/karavan-core/api/CamelDefinitionApi.ts
rename to karavan-app/src/main/webui/src/core/api/CamelDefinitionApi.ts
index 920fffe8..6bc4afde 100644
--- a/karavan-app/src/main/webui/src/karavan-core/api/CamelDefinitionApi.ts
+++ b/karavan-app/src/main/webui/src/core/api/CamelDefinitionApi.ts
@@ -96,7 +96,6 @@ import {
RouteTemplateDefinition,
RouteTemplateParameterDefinition,
RoutingSlipDefinition,
- SagaActionUriDefinition,
SagaDefinition,
SamplingDefinition,
ScriptDefinition,
@@ -1363,15 +1362,6 @@ export class CamelDefinitionApi {
return def;
}
- static createSagaActionUriDefinition = (element: any): SagaActionUriDefinition => {
- if (element && typeof element === 'string') {
- element = {uri: element};
- }
- const def = element ? new SagaActionUriDefinition({...element}) : new SagaActionUriDefinition();
- def.uuid = element?.uuid ? element.uuid : def.uuid;
- return def;
- }
-
static createSagaDefinition = (element: any): SagaDefinition => {
const def = element ? new SagaDefinition({...element}) : new SagaDefinition();
def.uuid = element?.uuid ? element.uuid : def.uuid;
@@ -3177,7 +3167,6 @@ export class CamelDefinitionApi {
case 'RouteTemplateDefinition': return CamelDefinitionApi.createRouteTemplateDefinition(newBody);
case 'RouteTemplateParameterDefinition': return CamelDefinitionApi.createRouteTemplateParameterDefinition(newBody);
case 'RoutingSlipDefinition': return CamelDefinitionApi.createRoutingSlipDefinition(newBody);
- case 'SagaActionUriDefinition': return CamelDefinitionApi.createSagaActionUriDefinition(newBody);
case 'SagaDefinition': return CamelDefinitionApi.createSagaDefinition(newBody);
case 'SamplingDefinition': return CamelDefinitionApi.createSamplingDefinition(newBody);
case 'ScriptDefinition': return CamelDefinitionApi.createScriptDefinition(newBody);
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/CamelDefinitionApiExt.ts b/karavan-app/src/main/webui/src/core/api/CamelDefinitionApiExt.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/api/CamelDefinitionApiExt.ts
rename to karavan-app/src/main/webui/src/core/api/CamelDefinitionApiExt.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/CamelDefinitionYaml.ts b/karavan-app/src/main/webui/src/core/api/CamelDefinitionYaml.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/api/CamelDefinitionYaml.ts
rename to karavan-app/src/main/webui/src/core/api/CamelDefinitionYaml.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/CamelDefinitionYamlStep.ts b/karavan-app/src/main/webui/src/core/api/CamelDefinitionYamlStep.ts
similarity index 99%
rename from karavan-app/src/main/webui/src/karavan-core/api/CamelDefinitionYamlStep.ts
rename to karavan-app/src/main/webui/src/core/api/CamelDefinitionYamlStep.ts
index cd52cd75..648fef9a 100644
--- a/karavan-app/src/main/webui/src/karavan-core/api/CamelDefinitionYamlStep.ts
+++ b/karavan-app/src/main/webui/src/core/api/CamelDefinitionYamlStep.ts
@@ -97,7 +97,6 @@ import {
RouteTemplateDefinition,
RouteTemplateParameterDefinition,
RoutingSlipDefinition,
- SagaActionUriDefinition,
SagaDefinition,
SamplingDefinition,
ScriptDefinition,
@@ -2230,14 +2229,6 @@ export class CamelDefinitionYamlStep {
return def;
}
- static readSagaActionUriDefinition = (element: any): SagaActionUriDefinition => {
- if (element && typeof element === 'string') element = {uri: element};
- let def = element ? new SagaActionUriDefinition({...element}) : new SagaActionUriDefinition();
- def = ComponentApi.parseElementUri(def);
-
- return def;
- }
-
static readSagaDefinition = (element: any): SagaDefinition => {
let def = element ? new SagaDefinition({...element}) : new SagaDefinition();
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/CamelDisplayUtil.ts b/karavan-app/src/main/webui/src/core/api/CamelDisplayUtil.ts
similarity index 92%
rename from karavan-app/src/main/webui/src/karavan-core/api/CamelDisplayUtil.ts
rename to karavan-app/src/main/webui/src/core/api/CamelDisplayUtil.ts
index d0fb38c7..1eeb3090 100644
--- a/karavan-app/src/main/webui/src/karavan-core/api/CamelDisplayUtil.ts
+++ b/karavan-app/src/main/webui/src/core/api/CamelDisplayUtil.ts
@@ -14,14 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { Integration, CamelElement } from '../model/IntegrationDefinition';
-import { CamelUtil } from './CamelUtil';
-import { CamelDefinitionApi } from './CamelDefinitionApi';
-import { CamelDefinitionApiExt } from './CamelDefinitionApiExt';
-import { KameletModel } from '../model/KameletModels';
-import { RouteDefinition } from '../model/CamelDefinition';
-import { ComponentApi } from './ComponentApi';
-import { CamelMetadataApi } from '../model/CamelMetadata';
+import {CamelElement, Integration} from '../model/IntegrationDefinition';
+import {CamelUtil} from './CamelUtil';
+import {CamelDefinitionApi} from './CamelDefinitionApi';
+import {CamelDefinitionApiExt} from './CamelDefinitionApiExt';
+import {KameletModel} from '../model/KameletModels';
+import {ComponentApi} from './ComponentApi';
+import {CamelMetadataApi} from '../model/CamelMetadata';
export class CamelDisplayUtil {
private constructor() {}
@@ -57,7 +56,7 @@ export class CamelDisplayUtil {
}
static getStepDescription = (element: CamelElement): string => {
- const description = (element as any).description;
+ const description = (element as any).description?.toString();
return description ? description : CamelDisplayUtil.getTitle(element);
}
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/CamelUtil.ts b/karavan-app/src/main/webui/src/core/api/CamelUtil.ts
similarity index 98%
rename from karavan-app/src/main/webui/src/karavan-core/api/CamelUtil.ts
rename to karavan-app/src/main/webui/src/core/api/CamelUtil.ts
index b87af3b2..4ed02ae2 100644
--- a/karavan-app/src/main/webui/src/karavan-core/api/CamelUtil.ts
+++ b/karavan-app/src/main/webui/src/core/api/CamelUtil.ts
@@ -34,7 +34,7 @@ import {CamelDefinitionApiExt} from './CamelDefinitionApiExt';
import {v4 as uuidv4} from 'uuid';
import {CamelDefinitionYaml} from './CamelDefinitionYaml';
import {ProjectFile} from "@models/ProjectModels";
-import {KARAVAN_DOT_EXTENSION} from "@karavan-core/contants";
+import {KARAVAN_DOT_EXTENSION} from "../contants";
export class CamelUtil {
private constructor() {
@@ -173,7 +173,7 @@ export class CamelUtil {
return KameletApi.findKameletByName(kameletName);
} else if (['FromDefinition', 'ToDynamicDefinition', 'ToDefinition', 'WireTapDefinition'].includes(element.dslName)) {
const uri: string = (element as any).uri;
- return uri !== undefined ? KameletApi.findKameletByUri(uri) : undefined;
+ return uri !== undefined && typeof uri === "string" && uri?.startsWith("kamelet:") ? KameletApi.findKameletByUri(uri) : undefined;
} else {
return undefined;
}
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/ComponentApi.ts b/karavan-app/src/main/webui/src/core/api/ComponentApi.ts
similarity index 98%
rename from karavan-app/src/main/webui/src/karavan-core/api/ComponentApi.ts
rename to karavan-app/src/main/webui/src/core/api/ComponentApi.ts
index 5b532f43..46c2c40c 100644
--- a/karavan-app/src/main/webui/src/karavan-core/api/ComponentApi.ts
+++ b/karavan-app/src/main/webui/src/core/api/ComponentApi.ts
@@ -14,8 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { Component, ComponentHeader, ComponentProperty, SupportedComponent } from '../model/ComponentModels';
-import { CamelElement } from '../model/IntegrationDefinition';
+import {Component, ComponentHeader, ComponentProperty, SupportedComponent} from '../model/ComponentModels';
+import {CamelElement} from '../model/IntegrationDefinition';
const Components: Component[] = [];
const SupportedComponents: SupportedComponent[] = [];
@@ -114,7 +114,7 @@ export class ComponentApi {
};
static getComponentTitleFromUri = (uri: string): string | undefined => {
- if (uri !== undefined) {
+ if (uri !== undefined && typeof uri === "string") {
const componentName = uri.split(':')[0];
const title = ComponentApi.findByName(componentName)?.component.title;
return title ? title : componentName;
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/KameletApi.ts b/karavan-app/src/main/webui/src/core/api/KameletApi.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/api/KameletApi.ts
rename to karavan-app/src/main/webui/src/core/api/KameletApi.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/MainConfigurationApi.ts b/karavan-app/src/main/webui/src/core/api/MainConfigurationApi.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/api/MainConfigurationApi.ts
rename to karavan-app/src/main/webui/src/core/api/MainConfigurationApi.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/ProjectModelApi.ts b/karavan-app/src/main/webui/src/core/api/ProjectModelApi.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/api/ProjectModelApi.ts
rename to karavan-app/src/main/webui/src/core/api/ProjectModelApi.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/SpiBeanApi.ts b/karavan-app/src/main/webui/src/core/api/SpiBeanApi.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/api/SpiBeanApi.ts
rename to karavan-app/src/main/webui/src/core/api/SpiBeanApi.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/TemplateApi.ts b/karavan-app/src/main/webui/src/core/api/TemplateApi.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/api/TemplateApi.ts
rename to karavan-app/src/main/webui/src/core/api/TemplateApi.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/TopologyUtils.ts b/karavan-app/src/main/webui/src/core/api/TopologyUtils.ts
similarity index 92%
rename from karavan-app/src/main/webui/src/karavan-core/api/TopologyUtils.ts
rename to karavan-app/src/main/webui/src/core/api/TopologyUtils.ts
index a2ba5024..b9f2a2ba 100644
--- a/karavan-app/src/main/webui/src/karavan-core/api/TopologyUtils.ts
+++ b/karavan-app/src/main/webui/src/core/api/TopologyUtils.ts
@@ -30,8 +30,6 @@ import {
} from '../model/CamelDefinition';
import {CamelElement, Integration,} from '../model/IntegrationDefinition';
import {
- TopologyAsyncApiNode,
- TopologyAsyncApiOperation,
TopologyBeanNode,
TopologyIncomingNode,
TopologyOpenApiNode,
@@ -45,7 +43,7 @@ import {ComponentApi, INTERNAL_COMPONENTS} from './ComponentApi';
import {CamelDefinitionApiExt} from './CamelDefinitionApiExt';
import {CamelDisplayUtil} from './CamelDisplayUtil';
import {CamelUtil} from './CamelUtil';
-import {LANDSCAPE_FILE_NAME_JSON, OPENAPI_FILE_NAME_JSON, X_APPLICATION_ID} from '../contants';
+import {OPENAPI_FILE_NAME_JSON} from '../contants';
const outgoingDefinitions: string[] = ['ToDefinition', 'KameletDefinition', 'ToDynamicDefinition', 'PollEnrichDefinition', 'EnrichDefinition', 'WireTapDefinition', 'SagaDefinition', 'PollDefinition'];
@@ -221,37 +219,6 @@ export class TopologyUtils {
return new TopologyOpenApiNode(OPENAPI_FILE_NAME_JSON, title, operations);
};
- static findTopologyAsyncApiNodes = (json: string, applicationName?: string): TopologyAsyncApiNode => {
- const operations: TopologyAsyncApiOperation[] = [];
- let title = 'AsyncAPI';
-
- try {
- const asyncapi = JSON.parse(json);
- if (asyncapi.info && typeof asyncapi.info.title === "string") {
- title = asyncapi.info.title;
- }
-
- if (asyncapi.operations) {
- Object.keys(asyncapi.operations).forEach((operationId) => {
- const operation = asyncapi.operations[operationId];
- const xApplication: string = operation?.[X_APPLICATION_ID]
- if (applicationName === undefined || applicationName === xApplication) {
- operations.push(
- new TopologyAsyncApiOperation(
- operationId,
- operation.summary,
- operation.action,
- operation.channel?.$ref
- )
- );
- }
- });
- }
- } catch (err) {
- console.error(err);
- }
- return new TopologyAsyncApiNode(LANDSCAPE_FILE_NAME_JSON, title, operations);
- };
static findTopologyIncomingNodes = (integration: Integration[]): TopologyIncomingNode[] => {
const result: TopologyIncomingNode[] = [];
@@ -265,7 +232,7 @@ export class TopologyUtils {
const type = TopologyUtils.isElementInternalComponent(r.from) ? 'internal' : 'external';
const connectorType = TopologyUtils.getConnectorType(r.from);
const uniqueUri = TopologyUtils.getUniqueUri(r.from);
- return new TopologyIncomingNode(id, type, connectorType, r.id, title, filename, r.from, uniqueUri);
+ return new TopologyIncomingNode(id, type, connectorType, r.id, r.group, title, filename, r.from, uniqueUri);
}) || [];
result.push(...routeElements);
const templates = i.spec.flows?.filter(flow => flow.dslName === 'RouteTemplateDefinition');
@@ -276,7 +243,7 @@ export class TopologyUtils {
const type = TopologyUtils.isElementInternalComponent(r.from) ? 'internal' : 'external';
const connectorType = TopologyUtils.getConnectorType(r.from);
const uniqueUri = TopologyUtils.getUniqueUri(r.from);
- return new TopologyIncomingNode(id, type, connectorType, r.id, title, filename, r.from, uniqueUri);
+ return new TopologyIncomingNode(id, type, connectorType, r.id, r.group, title, filename, r.from, uniqueUri);
}) || [];
// result.push(...templateElements);
} catch (e) {
@@ -295,7 +262,7 @@ export class TopologyUtils {
const connectorType = TopologyUtils.getConnectorType(r.from);
let from = CamelUtil.cloneStep(r.from) as FromDefinition;
let uniqueUri = TopologyUtils.getUniqueUri(r.from);
- return new TopologyIncomingNode(id, type, connectorType, r.routeId, title, r.fileName, from, uniqueUri);
+ return new TopologyIncomingNode(id, type, connectorType, r.routeId, r.route?.group, title, r.fileName, from, uniqueUri);
}) || [];
result.push(...routeElements);
return result;
@@ -309,7 +276,7 @@ export class TopologyUtils {
const routes = i.spec.flows?.filter(flow => flow.dslName === 'RouteDefinition');
const routeElements = routes?.map(r => {
const id = 'route-' + r.id;
- const title = '' + (r.description ? r.description : r.id);
+ const title = r.note?.trim()?.length > 0 ? r.note : (r.description ? r.description : r.id);
return new TopologyRouteNode(id, r.id, title, filename, r.from, r);
}) || [];
result.push(...routeElements);
@@ -317,7 +284,7 @@ export class TopologyUtils {
const templateElements = templates?.map(t => {
const r = t.route;
const id = 'route-' + r.id;
- const title = '' + (r.description ? r.description : r.id);
+ const title = r.note?.trim()?.length > 0 ? r.note : (r.description ? r.description : r.id);
return new TopologyRouteNode(id, r.id, title, filename, r.from, r, t.id, t.description);
}) || [];
result.push(...templateElements);
@@ -367,7 +334,7 @@ export class TopologyUtils {
connectorType !== 'kamelet' ||
CamelUtil.getKamelet(e)?.metadata.labels['camel.apache.org/kamelet.type'] !== 'action'
) {
- result.push(new TopologyOutgoingNode(id, type, connectorType, route.id, title, filename, e, uniqueUri));
+ result.push(new TopologyOutgoingNode(id, type, connectorType, route.id, route.group, title, filename, e, uniqueUri));
}
});
result.push(...TopologyUtils.findDeadLetterChannelNodes(route, filename));
@@ -397,7 +364,7 @@ export class TopologyUtils {
connectorType !== 'kamelet' ||
CamelUtil.getKamelet(e)?.metadata.labels['camel.apache.org/kamelet.type'] !== 'action'
) {
- result.push(new TopologyOutgoingNode(id, type, connectorType, route.routeId, title, filename, step, uniqueUri));
+ result.push(new TopologyOutgoingNode(id, type, connectorType, route.routeId, route.route.group, title, filename, step, uniqueUri));
}
});
result.push(...TopologyUtils.findDeadLetterChannelNodes(route.route, filename));
@@ -420,7 +387,7 @@ export class TopologyUtils {
const title = CamelDisplayUtil.getStepDescription(deadLetterChannel);
const type = 'internal';
const connectorType = 'component';
- result.push(new TopologyOutgoingNode(id, type, connectorType, route.id || '', title, filename, deadLetterChannel, deadLetterUri));
+ result.push(new TopologyOutgoingNode(id, type, connectorType, route.id || '', route.group, title, filename, deadLetterChannel, deadLetterUri));
}
}
} catch (e) {
@@ -450,7 +417,7 @@ export class TopologyUtils {
const type = TopologyUtils.isElementInternalComponent(e) ? 'internal' : 'external';
const connectorType = TopologyUtils.getConnectorType(e);
const uniqueUri = TopologyUtils.getUniqueUri(e);
- result.push(new TopologyOutgoingNode(id, type, connectorType, rc.id || 'undefined', title, filename, e, uniqueUri));
+ result.push(new TopologyOutgoingNode(id, type, connectorType, rc.id || 'undefined', "", title, filename, e, uniqueUri));
});
});
if (rc.errorHandler?.deadLetterChannel) {
@@ -461,7 +428,7 @@ export class TopologyUtils {
const type = INTERNAL_COMPONENTS.includes(comp) ? 'internal' : 'external';
const connectorType = 'component';
const uniqueUri = e?.deadLetterUri;
- result.push(new TopologyOutgoingNode(id, type, connectorType, rc.id || 'undefined', title, filename, e, uniqueUri));
+ result.push(new TopologyOutgoingNode(id, type, connectorType, rc.id || 'undefined', "", title, filename, e, uniqueUri));
}
});
} catch (e) {
diff --git a/karavan-app/src/main/webui/src/karavan-core/api/VariableUtil.ts b/karavan-app/src/main/webui/src/core/api/VariableUtil.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/api/VariableUtil.ts
rename to karavan-app/src/main/webui/src/core/api/VariableUtil.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/contants.ts b/karavan-app/src/main/webui/src/core/contants.ts
similarity index 81%
rename from karavan-app/src/main/webui/src/karavan-core/contants.ts
rename to karavan-app/src/main/webui/src/core/contants.ts
index b0f7f97f..2d89d4b6 100644
--- a/karavan-app/src/main/webui/src/karavan-core/contants.ts
+++ b/karavan-app/src/main/webui/src/core/contants.ts
@@ -21,8 +21,9 @@ export const KARAVAN_DOT_EXTENSION = {
export const FILE_WORDS_SEPARATOR = '-'
export const OPENAPI_FILE_NAME_JSON = 'openapi.json';
export const OPENAPI_FILE_NAME_YAML = 'openapi.yaml';
+export const JSON_EXTENSION = ".json";
export const JSON_SCHEMA_EXTENSION = ".schema.json";
-export const LANDSCAPE_FILE_NAME_JSON = "";
-export const X_APPLICATION_ID = "x-application-id";
export const WIZARD_BEAN_TEMPLATE_FILENAME_PREFIX = "wizard-bean-";
+export const OPENAPI_ROUTE_TEMPLATE_FILENAME = "openapi-route.camel.yaml";
+export const REST_CONFIGURATION_FILENAME = "rest-configuration.camel.yaml";
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan-core/model/CamelDefinition.ts b/karavan-app/src/main/webui/src/core/model/CamelDefinition.ts
similarity index 99%
rename from karavan-app/src/main/webui/src/karavan-core/model/CamelDefinition.ts
rename to karavan-app/src/main/webui/src/core/model/CamelDefinition.ts
index cc8a7f99..82ac19a3 100644
--- a/karavan-app/src/main/webui/src/karavan-core/model/CamelDefinition.ts
+++ b/karavan-app/src/main/webui/src/core/model/CamelDefinition.ts
@@ -1282,6 +1282,7 @@ export class RouteDefinition extends CamelElement {
messageHistory?: boolean;
logMask?: boolean;
errorHandlerRef?: string;
+ routePolicyRef?: string;
shutdownRoute?: string;
shutdownRunningTask?: string;
precondition?: string;
@@ -1338,20 +1339,6 @@ export class RoutingSlipDefinition extends CamelElement {
}
}
-export class SagaActionUriDefinition extends CamelElement {
- stepName?: string = 'sagaActionUri';
- description?: string;
- disabled?: boolean;
- id?: string = 'sagaActionUri' + uuidv4().substring(0,4);
- note?: string;
- parameters?: any = {};
- uri: string = '';
- public constructor(init?: Partial<SagaActionUriDefinition>) {
- super('SagaActionUriDefinition');
- Object.assign(this, init);
- }
-}
-
export class SagaDefinition extends CamelElement {
stepName?: string = 'saga';
id?: string = 'saga' + uuidv4().substring(0,4);
diff --git a/karavan-app/src/main/webui/src/karavan-core/model/CamelMetadata.ts b/karavan-app/src/main/webui/src/core/model/CamelMetadata.ts
similarity index 99%
rename from karavan-app/src/main/webui/src/karavan-core/model/CamelMetadata.ts
rename to karavan-app/src/main/webui/src/core/model/CamelMetadata.ts
index 4da402ce..cb68f110 100644
--- a/karavan-app/src/main/webui/src/karavan-core/model/CamelMetadata.ts
+++ b/karavan-app/src/main/webui/src/core/model/CamelMetadata.ts
@@ -137,7 +137,6 @@ export const DataFormats: [string, string, string][] = [
['csv','CSV',"Handle CSV (Comma Separated Values) payloads."],
['custom','Custom',"Delegate to a custom org.apache.camel.spi.DataFormat implementation via Camel registry."],
['dfdl','DFDL',"Transforms fixed format data such as EDI message from/to XML using a Data Format Description Language (DFDL)."],
- ['dfdl','DFDL',"Transforms fixed format data such as EDI message from/to XML using a Data Format Description Language (DFDL)."],
['fhirJson','FHIR JSon',"Marshall and unmarshall FHIR objects to/from JSON."],
['fhirXml','FHIR XML',"Marshall and unmarshall FHIR objects to/from XML."],
['flatpack','Flatpack',"Marshal and unmarshal Java lists and maps to/from flat files (such as CSV, delimited, or fixed length formats) using Flatpack library."],
@@ -154,8 +153,10 @@ export const DataFormats: [string, string, string][] = [
['jsonApi','JSonApi',"Marshal and unmarshal JSON:API resources using JSONAPI-Converter library."],
['lzf','LZF Deflate Compression',"Compress and decompress streams using LZF deflate algorithm."],
['mimeMultipart','MIME Multipart',"Marshal Camel messages with attachments into MIME-Multipart messages and back."],
+ ['ocsf','OCSF',"Marshal and unmarshal OCSF (Open Cybersecurity Schema Framework) security events to/from JSON."],
['parquetAvro','Parquet File',"Parquet Avro serialization and de-serialization."],
['pgp','PGP',"Encrypt and decrypt messages using Java Cryptographic Extension (JCE) and PGP."],
+ ['pqc','PQC (Post-Quantum Cryptography)',"Encrypt and decrypt messages using Post-Quantum Cryptography Key Encapsulation Mechanisms (KEM)."],
['protobuf','Protobuf',"Serialize and deserialize Java objects using Google's Protocol buffers."],
['rss','RSS',"Transform from ROME SyndFeed Java Objects to XML and vice-versa."],
['smooks','Smooks',"Transform and bind XML as well as non-XML data, including EDI, CSV, JSON, and YAML using Smooks."],
@@ -1988,6 +1989,7 @@ export const CamelModelMetadata: ElementMeta[] = [
new PropertyMeta('messageHistory', 'Message History', "Whether message history is enabled on this route.", 'boolean', '', 'false', false, false, false, false, '', ''),
new PropertyMeta('logMask', 'Log Mask', "Whether security mask for Logging is enabled on this route.", 'boolean', '', 'false', false, false, false, false, '', ''),
new PropertyMeta('errorHandlerRef', 'Error Handler', "Sets the bean ref name of the error handler builder to use on this route", 'string', '', '', false, false, false, false, 'error', ''),
+ new PropertyMeta('routePolicyRef', 'Route Policy', "Reference to custom org.apache.camel.spi.RoutePolicy to use by the route. Multiple policies can be configured by separating values using comma.", 'string', '', '', false, false, false, false, '', ''),
new PropertyMeta('shutdownRoute', 'Shutdown Route', "To control how to shutdown the route.", 'string', 'Default, Defer', '', false, false, false, false, 'advanced', ''),
new PropertyMeta('shutdownRunningTask', 'Shutdown Running Task', "To control how to shut down the route.", 'string', 'CompleteCurrentTaskOnly, CompleteAllTasks', '', false, false, false, false, 'advanced', ''),
new PropertyMeta('precondition', 'Precondition', "The predicate of the precondition in simple language to evaluate in order to determine if this route should be included or not.", 'string', '', '', false, false, false, false, 'advanced', ''),
@@ -1995,7 +1997,6 @@ export const CamelModelMetadata: ElementMeta[] = [
new PropertyMeta('inputType', 'Input Type', "Declare the expected data type of the input message. If the actual message type is different at runtime, camel look for a required org.apache.camel.spi.Transformer and apply if exists. The type name consists of two parts, 'scheme' and 'name' connected with ':'. For Java type 'name' is a fully qualified class name. For example {code java:java.lang.String} , {code json:ABCOrder} .", 'InputTypeDefinition', '', '', false, false, false, tru [...]
new PropertyMeta('outputType', 'Output Type', "Declare the expected data type of the output message. If the actual message type is different at runtime, camel look for a required org.apache.camel.spi.Transformer and apply if exists. The type name consists of two parts, 'scheme' and 'name' connected with ':'. For Java type 'name' is a fully qualified class name. For example {code java:java.lang.String} , {code json:ABCOrder} .", 'OutputTypeDefinition', '', '', false, false, false, [...]
new PropertyMeta('from', 'from', "from", 'FromDefinition', '', '', false, false, false, true, '', ''),
- new PropertyMeta('routePolicy', 'routePolicy', "routePolicy", 'string', '', '', false, false, false, false, '', ''),
], [
]),
new ElementMeta('routeTemplate', 'RouteTemplateDefinition', 'Route Template', "Defines a route template (parameterized routes)", 'configuration', [
@@ -2077,6 +2078,22 @@ export const CamelModelMetadata: ElementMeta[] = [
new PropertyMeta('put', 'put', "put", 'PutDefinition', '', '', false, false, true, true, '', ''),
], [
]),
+ new ElementMeta('beanFactory', 'BeanFactoryDefinition', 'Bean Factory', "Define custom beans that can be used in your Camel routes and in general.", 'configuration', [
+ new PropertyMeta('name', 'Name', "The name of the bean (bean id)", 'string', '', '', true, false, false, false, '', ''),
+ new PropertyMeta('type', 'Type', "The class name (fully qualified) of the bean", 'string', '', '', true, false, false, false, '', ''),
+ new PropertyMeta('initMethod', 'Init Method', "The name of the custom initialization method to invoke after setting bean properties. The method must have no arguments, but may throw any exception.", 'string', '', '', false, false, false, false, '', ''),
+ new PropertyMeta('destroyMethod', 'Destroy Method', "The name of the custom destroy method to invoke on bean shutdown, such as when Camel is shutting down. The method must have no arguments, but may throw any exception.", 'string', '', '', false, false, false, false, '', ''),
+ new PropertyMeta('factoryMethod', 'Factory Method', "Name of method to invoke when creating the bean via a factory bean.", 'string', '', '', false, false, false, false, '', ''),
+ new PropertyMeta('factoryBean', 'Factory Bean', "Name of factory bean (bean id) to use for creating the bean.", 'string', '', '', false, false, false, false, '', ''),
+ new PropertyMeta('builderClass', 'Builder Class', "Fully qualified class name of builder class to use for creating and configuring the bean. The builder will use the properties values to configure the bean.", 'string', '', '', false, false, false, false, '', ''),
+ new PropertyMeta('builderMethod', 'Builder Method', "Name of method when using builder class. This method is invoked after configuring to create the actual bean. This method is often named build (used by default).", 'string', '', 'build', false, false, false, false, '', ''),
+ new PropertyMeta('scriptLanguage', 'Script Language', "The script language to use when using inlined script for creating the bean, such as groovy, java, javascript etc.", 'string', '', '', false, false, false, false, 'advanced', ''),
+ new PropertyMeta('scriptPropertyPlaceholders', 'Script Property Placeholders', "Whether the script should support using Camel property placeholder syntax {{ }}.", 'boolean', '', 'true', false, false, false, false, 'advanced', ''),
+ new PropertyMeta('constructors', 'Constructors', "Optional constructor arguments for creating the bean. Arguments correspond to specific index of the constructor argument list, starting from zero.", 'object', '', '', false, false, false, false, '', ''),
+ new PropertyMeta('properties', 'Properties', "Optional properties to set on the created bean.", 'object', '', '', false, false, false, false, '', ''),
+ new PropertyMeta('script', 'Script', "The script to execute that creates the bean when using scripting languages. If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.", 'string', '', '', false, false, false, false, 'advanced', ''),
+ ], [
+ ]),
new ElementMeta('contextScan', 'ContextScanDefinition', 'Context Scan', "Scans for Java org.apache.camel.builder.RouteBuilder instances in the context org.apache.camel.spi.Registry .", 'configuration', [
new PropertyMeta('includeNonSingletons', 'Include Non Singletons', "Whether to include non-singleton beans (prototypes) By default only singleton beans is included in the context scan", 'boolean', '', 'false', false, false, false, false, 'advanced', ''),
new PropertyMeta('excludes', 'Excludes', "Exclude finding route builder from these java package names.", 'string', '', '', false, false, true, true, '', ''),
@@ -2941,88 +2958,88 @@ export const CamelModelMetadata: ElementMeta[] = [
]
export const SensitiveKeys: string[] = [
- "accesskey",
+ "oauthtokenurl",
+ "clientid",
+ "sassignature",
+ "connectionstring",
+ "sslpassword",
+ "keypassword",
"accesstoken",
- "accesstokensecret",
"accountkey",
- "accountsid",
+ "proxyauthusername",
+ "sslkeypassword",
+ "userpassword",
"acltoken",
- "api_key",
- "api_secret",
- "apikey",
- "apipassword",
- "apiuser",
- "apiusername",
- "authenticationtoken",
- "authkey",
- "authorizationtoken",
- "authtoken",
- "azureclientid",
- "azureclientsecret",
- "blobaccesskey",
- "blobstoragesharedkeycredential",
- "certresourcepassword",
- "clientid",
- "clientsecret",
- "clientsecretcredential",
- "connectionstring",
- "consumerkey",
+ "password",
+ "accesskey",
"consumersecret",
- "emailaddress",
- "httpproxypassword",
- "kerberosauthticket",
- "keypassword",
- "keystorePassword",
- "keystorepassword",
- "login",
- "oauthclientid",
+ "proxyuser",
+ "azureclientid",
"oauthclientsecret",
- "oauthtoken",
- "oauthtokenurl",
+ "truststorepassword",
+ "accesstokensecret",
+ "saslpassword",
+ "securerandom",
+ "refreshtoken",
+ "sessiontoken",
+ "publishkey",
+ "accountsid",
+ "emailaddress",
+ "blobaccesskey",
+ "azureclientsecret",
+ "publickeyid",
"p12filename",
- "passcode",
+ "ssltruststorepassword",
+ "userauthenticationcredentials",
"passphrase",
- "password",
- "personalaccesstoken",
- "privatekey",
"privatekeyfile",
+ "zookeeperpassword",
+ "apiuser",
+ "personalaccesstoken",
+ "authkey",
"privatekeyname",
- "privatekeypassword",
- "proxyauthpassword",
- "proxyauthusername",
- "proxypassword",
- "proxyuser",
+ "systemid",
"proxyusername",
- "publickeyid",
- "publishkey",
- "queueownerawsaccountid",
- "realm",
- "refreshtoken",
- "sascredential",
- "sasljaasconfig",
- "saslpassword",
- "sassignature",
- "secret",
"secretkey",
- "securerandom",
- "serviceinstanceid",
- "sessiontoken",
- "sharedaccesskey",
+ "webhookverifytoken",
+ "privatekeypassword",
+ "secret",
+ "login",
"sourceblobaccesskey",
- "sslkeypassword",
+ "authenticationtoken",
+ "apipassword",
+ "privatekey",
"sslkeystorepassword",
- "sslpassword",
- "ssltruststorepassword",
+ "oauthtoken",
+ "sascredential",
+ "verificationcode",
+ "serviceinstanceid",
"subscribekey",
- "systemid",
- "token",
+ "certresourcepassword",
+ "clientsecretcredential",
+ "keystorepassword",
+ "oauthclientid",
+ "apikey",
+ "keystorePassword",
+ "clientsecret",
+ "authtoken",
"tokencredential",
- "truststorepassword",
+ "blobstoragesharedkeycredential",
+ "kerberosauthticket",
+ "proxypassword",
+ "queueownerawsaccountid",
+ "token",
+ "proxyauthpassword",
+ "authorizationtoken",
+ "sharedaccesskey",
+ "apiusername",
+ "api_key",
+ "sasljaasconfig",
+ "httpproxypassword",
+ "realm",
"user",
- "userauthenticationcredentials",
- "username",
- "userpassword",
- "verificationcode",
- "webhookverifytoken",
- "zookeeperpassword"
+ "api_secret",
+ "passcode",
+ "consumerkey",
+ "username"
]
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan-core/model/ComponentModels.ts b/karavan-app/src/main/webui/src/core/model/ComponentModels.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/model/ComponentModels.ts
rename to karavan-app/src/main/webui/src/core/model/ComponentModels.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/model/IntegrationDefinition.ts b/karavan-app/src/main/webui/src/core/model/IntegrationDefinition.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/model/IntegrationDefinition.ts
rename to karavan-app/src/main/webui/src/core/model/IntegrationDefinition.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/model/KameletModels.ts b/karavan-app/src/main/webui/src/core/model/KameletModels.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/model/KameletModels.ts
rename to karavan-app/src/main/webui/src/core/model/KameletModels.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/model/MainConfigurationModel.ts b/karavan-app/src/main/webui/src/core/model/MainConfigurationModel.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/model/MainConfigurationModel.ts
rename to karavan-app/src/main/webui/src/core/model/MainConfigurationModel.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/model/ProjectModel.ts b/karavan-app/src/main/webui/src/core/model/ProjectModel.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/model/ProjectModel.ts
rename to karavan-app/src/main/webui/src/core/model/ProjectModel.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/model/SpiBeanModels.ts b/karavan-app/src/main/webui/src/core/model/SpiBeanModels.ts
similarity index 100%
rename from karavan-app/src/main/webui/src/karavan-core/model/SpiBeanModels.ts
rename to karavan-app/src/main/webui/src/core/model/SpiBeanModels.ts
diff --git a/karavan-app/src/main/webui/src/karavan-core/model/TopologyDefinition.ts b/karavan-app/src/main/webui/src/core/model/TopologyDefinition.ts
similarity index 92%
rename from karavan-app/src/main/webui/src/karavan-core/model/TopologyDefinition.ts
rename to karavan-app/src/main/webui/src/core/model/TopologyDefinition.ts
index 03f4fbe1..f92ca793 100644
--- a/karavan-app/src/main/webui/src/karavan-core/model/TopologyDefinition.ts
+++ b/karavan-app/src/main/webui/src/core/model/TopologyDefinition.ts
@@ -93,17 +93,19 @@ export class TopologyIncomingNode {
type: 'internal' | 'external';
connectorType: 'component' | 'kamelet';
routeId: string;
+ routeGroup: string;
title: string;
fileName: string;
from: FromDefinition;
uniqueUri?: string;
- constructor(id: string, type: "internal" | "external", connectorType: "component" | "kamelet", routeId: string, title: string, fileName: string, from: FromDefinition, uniqueUri: string) {
+ constructor(id: string, type: "internal" | "external", connectorType: "component" | "kamelet", routeId: string, routeGroup: string, title: string, fileName: string, from: FromDefinition, uniqueUri: string) {
this.id = id;
this.type = type;
this.connectorType = connectorType;
this.routeId = routeId;
+ this.routeGroup = routeGroup;
this.title = title;
this.fileName = fileName;
this.from = from;
@@ -154,17 +156,19 @@ export class TopologyOutgoingNode {
type: 'internal' | 'external';
connectorType: 'component' | 'kamelet';
routeId: string;
+ routeGroup: string;
title: string;
fileName: string;
step: CamelElement;
uniqueUri?: string;
- constructor(id: string, type: "internal" | "external", connectorType: "component" | "kamelet", routeId: string, title: string, fileName: string, step: CamelElement, uniqueUri: string) {
+ constructor(id: string, type: "internal" | "external", connectorType: "component" | "kamelet", routeId: string, routeGroup: string, title: string, fileName: string, step: CamelElement, uniqueUri: string) {
this.id = id;
this.type = type;
this.connectorType = connectorType;
this.routeId = routeId;
+ this.routeGroup = routeGroup;
this.title = title;
this.fileName = fileName;
this.step = step;
diff --git a/karavan-app/src/main/webui/src/karavan/api/AccessApi.tsx b/karavan-app/src/main/webui/src/karavan/api/AccessApi.tsx
deleted file mode 100644
index e6cd1812..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/AccessApi.tsx
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import axios, {AxiosResponse} from "axios";
-import {AccessPassword, AccessRole, AccessUser} from "../models/AccessModels";
-import {ErrorEventBus} from "@bus/ErrorEventBus";
-import {AuthApi} from "@api/auth/AuthApi";
-
-axios.defaults.headers.common['Accept'] = 'application/json';
-axios.defaults.headers.common['Content-Type'] = 'application/json';
-const instance = AuthApi.getInstance();
-
-export class AccessApi {
-
- static async getUser(username: string, after: (user: AccessUser) => void) {
- instance.get('/ui/access/users/' + username)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- } else {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- after(err);
- });
- }
-
- static async putUser(user: AccessUser, after: (result: boolean, res: AxiosResponse<AccessUser> | any) => void) {
- try {
- instance.put('/ui/access/users', user)
- .then(res => {
- if (res.status === 200) {
- after(true, res);
- }
- }).catch(err => {
- after(false, err);
- });
- } catch (error: any) {
- after(false, error);
- }
- }
-
- static async getUsers(after: (users: AccessUser[]) => void) {
- instance.get('/ui/access/users')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- } else {
- after([]);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- after([]);
- });
- }
- static async getRoles(after: (users: AccessRole[]) => void) {
- instance.get('/ui/access/roles')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- } else {
- after([]);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- after([]);
- });
- }
-
- static async postUser(user: AccessUser, after: (result: boolean, res: AxiosResponse<AccessUser> | any) => void) {
- try {
- instance.post('/ui/access/users', user)
- .then(res => {
- if (res.status === 200 || res.status === 201) {
- after(true, res);
- }
- }).catch(err => {
- console.error(err);
- after(false, err);
- });
- } catch (error: any) {
- console.error(error);
- after(false, error);
- }
- }
-
- static async deleteUser(username: string, after: (result: boolean, res: AxiosResponse<any> | any) => void) {
- try {
- instance.delete('/ui/access/users/' + username)
- .then(res => {
- if (res.status === 202) {
- after(true, res);
- }
- }).catch(err => {
- after(false, err);
- });
- } catch (error: any) {
- after(false, error);
- }
- }
-
- static async deleteRole(rolename: string, after: (result: boolean, res: AxiosResponse<any> | any) => void) {
- try {
- instance.delete('/ui/access/roles/' + rolename)
- .then(res => {
- if (res.status === 202) {
- after(true, res);
- }
- }).catch(err => {
- after(false, err);
- });
- } catch (error: any) {
- after(false, error);
- }
- }
-
- static setUserStatus(user: AccessUser, status: string, after: (result: AccessUser) => void) {
- try {
- instance.put(`/ui/access/users/${status}`, user)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- after(err.data);
- });
- } catch (error: any) {
- after(error);
- }
- }
-
- static setUserRole(user: AccessUser, role: string | undefined, command: "activate" | "inactivate" | "add" | "remove", after: (result: AccessUser) => void) {
- try {
- instance.put(`/ui/access/userRole`, {username: user.username, role: role, command: command})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- after(err.data);
- });
- } catch (error: any) {
- after(error);
- }
- }
-
- static postRole(role: AccessRole, after: (result: boolean, res: any) => void) {
- try {
- instance.post('/ui/access/roles', role)
- .then(res => {
- if (res.status === 200 || res.status === 201) {
- after(true, res);
- }
- }).catch(err => {
- console.error(err);
- after(false, err);
- });
- } catch (error: any) {
- console.error(error);
- after(false, error);
- }
- }
-
- static setPassword(username: string, password: AccessPassword, after: (result: boolean, res: any) => void) {
- try {
- instance.post('/ui/access/password', {...password, username: username})
- .then(res => {
- if (res.status === 200 || res.status === 201 || res.status === 204) {
- after(true, res);
- }
- }).catch(err => {
- console.error(err);
- after(false, err);
- });
- } catch (error: any) {
- console.error(error);
- after(false, error);
- }
- }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/api/KaravanApi.tsx b/karavan-app/src/main/webui/src/karavan/api/KaravanApi.tsx
deleted file mode 100644
index 1d7c437e..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/KaravanApi.tsx
+++ /dev/null
@@ -1,764 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import axios, {AxiosResponse} from "axios";
-import {
- AppConfig,
- CamelStatus,
- CamelStatusName,
- ContainerStatus,
- DeploymentStatus,
- PodEvent,
- Project,
- ProjectCommited,
- ProjectFile,
- ProjectFileCommited,
- ProjectType,
- ServiceStatus
-} from "@models/ProjectModels";
-import {Buffer} from 'buffer';
-import {EventBus} from "@features/project/designer/utils/EventBus";
-import {ErrorEventBus} from "@bus/ErrorEventBus";
-import {AuthApi, getCurrentUser} from "@api/auth/AuthApi";
-
-const instance = AuthApi.getInstance();
-
-export class KaravanApi {
-
- static async getReadiness(after: (readiness: any) => void): Promise<void> {
- axios.get('/public/readiness', {headers: {'Accept': 'application/json'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- } else {
- after(undefined);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getConfiguration(after: (config: AppConfig) => void) {
- instance.get('/ui/configuration')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getInfrastructureInfo(after: (info: any) => void) {
- instance.get('/ui/configuration/info')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getProject(projectId: string, after: (project: Project) => void) {
- instance.get('/ui/project/' + projectId)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getAllCamelStatuses(name: CamelStatusName | null, after: (statuses: CamelStatus[]) => void) {
- instance.get(`/ui/status/camel/${name || ''}`)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getProjects(after: (projects: Project[]) => void, type?: ProjectType.integration) {
- instance.get('/ui/project' + (type !== undefined ? "?type=" + type : ""))
- .then(res => {
- if (res.status === 200) {
- after(res.data.map((p: Partial<Project> | undefined) => new Project(p)));
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
- static async getProjectsCommited(after: (projects: ProjectCommited[]) => void) {
- instance.get('/ui/project/commited/all')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async postProject(project: Project, after: (result: boolean, res: AxiosResponse<Project> | any) => void) {
- try {
- instance.post('/ui/project', project)
- .then(res => {
- if (res.status === 200) {
- after(true, res);
- }
- }).catch(err => {
- console.error(err);
- after(false, err);
- EventBus.sendAlert("Error", err?.message, "danger")
- });
- } catch (error: any) {
- console.error(error);
- after(false, error);
- EventBus.sendAlert("Error", error?.message, "danger")
- }
- }
-
- static copyProject(sourceProject: string, project: Project, after: (result: boolean, res: AxiosResponse<Project> | any) => void) {
- try {
- instance.post('/ui/project/copy/' + sourceProject, project)
- .then(res => {
- if (res.status === 200) {
- after(true, res);
- }
- }).catch(err => {
- after(false, err);
- });
- } catch (error: any) {
- after(false, error);
- }
- }
-
- static async deleteProject(project: Project, deleteContainers: boolean, after: (res: AxiosResponse<any>) => void) {
- instance.delete('/ui/project/' + encodeURI(project.projectId) + (deleteContainers ? '?deleteContainers=true' : ''))
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async buildProject(project: Project, tag: string, after: (res: AxiosResponse<any>) => void) {
- instance.post('/ui/project/build/' + tag, project)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async shareConfigurationFile(filename: string, after: (res: AxiosResponse<any>) => void) {
- await KaravanApi.shareConfigurations(after, filename);
- }
-
- static async shareConfigurations(after: (res: AxiosResponse<any>) => void, filename?: string,) {
- const params = {
- 'filename': filename,
- 'userId': getCurrentUser()?.username
- };
- instance.post('/ui/configuration/share/', params)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch((err: any) => {
- ErrorEventBus.sendApiError(err);
- const data = err.response?.data
- const message = typeof data === 'string' ? data : err.message;
- EventBus.sendAlert("Error", message, "danger")
- });
- }
-
- static async getFiles(projectId: string, after: (files: ProjectFile[]) => void) {
- instance.get(`/ui/file/${projectId}`)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
- static async getCommitedFiles(projectId: string, after: (files: ProjectFileCommited[]) => void) {
- instance.get(`/ui/file/commited/${projectId}`)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async loadProjectCommits(projectId: string, after: (res: any) => void) {
- instance.post(`/ui/git/commits/${projectId}`)
- .then(res => {
- if (res.status === 202) {
- after(res);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getSystemCommits(after: (res: any) => void) {
- instance.get(`/ui/git/system`)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getProjectFilesByName(projectId: string, filename: string, after: (files: ProjectFile) => void) {
- instance.get(`/ui/file/${projectId}?filename=${filename}`)
- .then(res => {
- if (res.status === 200 && res.data !== undefined) {
- after(res.data?.at(0));
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getFilesByName(filename: string, after: (files: ProjectFile[]) => void) {
- instance.get(`/ui/file?filename=${filename}`)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getFileCommited(projectId: string, filename: string, after: (file: ProjectFile) => void) {
- instance.get('/ui/file/commited/' + projectId + '/' + filename)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getFilesDiff(projectId: string, after: (diff: any) => void) {
- instance.get('/ui/file/diff/' + projectId)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async saveProjectFile(file: ProjectFile, after: (result: boolean, file: ProjectFile | any) => void) {
- try {
- instance.post('/ui/file', file)
- .then(res => {
- if (res.status === 200) {
- after(true, res.data);
- } else {
- after(false, res?.data);
- }
- }).catch(err => {
- console.error(err);
- after(false, err);
- });
- } catch (error: any) {
- console.error(error);
- after(false, error);
- }
- }
-
- static async renameProjectFile(projectId: string, filename: string, newName: string, after: (result: boolean, err?: Error) => void) {
- try {
- instance.patch(`/ui/file/${projectId}/${filename}`, {newName: newName})
- .then(res => {
- if (res.status === 200) {
- after(true);
- } else if (res.status === 409) {
- after(false, {message: res?.data} as Error);
- } else {
- after(false);
- }
- }).catch(err => {
- after(false, err);
- });
- } catch (error: any) {
- after(false, error);
- }
- }
-
- static async putProjectFile(file: ProjectFile, after: (res: AxiosResponse<any>) => void) {
- instance.put('/ui/file', file)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async deleteProjectFile(file: ProjectFile, after: (res: AxiosResponse<any>) => void) {
- instance.delete('/ui/file/' + file.projectId + '/' + file.name)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async copyProjectFile(fromProjectId: string, fromFilename: string, toProjectId: string, toFilename: string, overwrite: boolean, after: (res: AxiosResponse<any>) => void) {
- instance.post('/ui/file/copy', {fromProjectId: fromProjectId, fromFilename: fromFilename, toProjectId: toProjectId, toFilename: toFilename, overwrite: overwrite})
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async push(params: {}, after: (res: AxiosResponse<any>) => void) {
- instance.post('/ui/git', params)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async pull(projectId: string | undefined, after: (res: AxiosResponse<any> | any) => void) {
- instance.put(`/ui/git/${projectId ?? ''}`)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
-
- static async reloadDevModeCode(projectId: string, after: (res: AxiosResponse<any>) => void) {
- instance.get('/ui/devmode/reload/' + projectId)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async getProjectCamelStatuses(projectId: string, env: string, after: (res: AxiosResponse<CamelStatus[]>) => void) {
- instance.get('/ui/project/status/camel/' + projectId + "/" + env)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async getProjectCamelTraces(projectId: string, env: string, after: (res: AxiosResponse<CamelStatus[]>) => void) {
- instance.get('/ui/project/traces/' + projectId + "/" + env)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async startDevModeContainer(projectId: string, verbose: boolean, compile: boolean, after: (res: AxiosResponse<any>) => void) {
- instance.get(`/ui/devmode/run/${projectId}/${verbose.toString()}/${compile.toString()}`)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async deleteDevModeContainer(name: string, deletePVC: boolean, after: (res: AxiosResponse<any>) => void) {
- instance.delete('/ui/devmode/' + name + "/" + deletePVC)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
-
-
- static async stopBuild(environment: string, buildName: string, after: (res: AxiosResponse<any>) => void) {
- instance.delete('/ui/project/build/' + environment + "/" + buildName)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getContainerLog(environment: string, name: string, after: (res: AxiosResponse<string>) => void) {
- instance.get('/ui/container/log/' + environment + "/" + name)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getAllServiceStatuses(after: (statuses: ServiceStatus[]) => void) {
- instance.get('/ui/infrastructure/service')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getAllContainerStatuses(after: (statuses: ContainerStatus[]) => void) {
- instance.get('/ui/container')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getContainerStatus(projectId: string, env: string, after: (res: AxiosResponse<ContainerStatus[]>) => void) {
- instance.get('/ui/container/' + projectId + "/" + env)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async getAllDeploymentStatuses(after: (statuses: DeploymentStatus[]) => void) {
- instance.get('/ui/infrastructure/deployment')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getDeploymentStatuses(env: string, after: (statuses: DeploymentStatus[]) => void) {
- instance.get('/ui/infrastructure/deployment/' + env)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async rolloutDeployment(projectId: string, environment: string, after: (res: AxiosResponse<any>) => void) {
- instance.post('/ui/infrastructure/deployment/rollout/' + environment + '/' + projectId, "")
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async startDeployment(projectId: string, environment: string, after: (res: AxiosResponse<any>) => void) {
- instance.post('/ui/infrastructure/deployment/start/' + environment + '/' + projectId, "")
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async deleteDeployment(environment: string, name: string, after: (res: AxiosResponse<any>) => void) {
- instance.delete('/ui/infrastructure/deployment/' + environment + '/' + name)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async getPodEvents(containerName: string, after: (podEvents: PodEvent[]) => void) {
- instance.get('/ui/infrastructure/pod-events/' + containerName, {headers: {'Accept': 'application/json'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- } else {
- after([]);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- after([]);
- });
- }
-
- static async manageContainer(projectId: string,
- type: 'devmode' | 'packaged' | 'internal' | 'build' | 'unknown',
- name: string,
- command: 'deploy' | 'run' | 'pause' | 'stop' | 'delete',
- pullImage: 'always' | 'ifNotExists' | 'never',
- after: (res: AxiosResponse<any> | any) => void) {
- instance.post('/ui/container/' + projectId + '/' + type + "/" + name, {command: command, pullImage: pullImage})
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async deleteContainer(projectId: string, type: 'devmode' | 'packaged' | 'internal' | 'build' | 'unknown', name: string, after: (res: AxiosResponse<any>) => void) {
- instance.delete('/ui/container/' + projectId + '/' + type + "/" + name)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async getConfigMaps(after: (any: []) => void) {
- instance.get('/ui/infrastructure/configmaps/')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getImages(projectId: string, after: (string: []) => void) {
- instance.get('/ui/image/project/' + projectId)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async setProjectImage(projectId: string, imageName: string, commit: boolean, message: string, after: (res: AxiosResponse<any>) => void) {
- instance.post('/ui/image/project/' + projectId, {imageName: imageName, commit: commit, message: message})
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async deleteImage(imageName: string, after: () => void) {
- instance.delete('/ui/image/project/' + Buffer.from(imageName).toString('base64'))
- .then(res => {
- if (res.status === 200) {
- after();
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async pullProjectImages(projectId: string, after: (res: AxiosResponse<any>) => void) {
- const params = {
- 'projectId': projectId,
- 'userId': getCurrentUser()?.username
- };
- instance.post('/ui/image/pull/', params)
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async getSecrets(after: (any: []) => void) {
- instance.get('/ui/infrastructure/secrets')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getServices(after: (any: []) => void) {
- instance.get('/ui/infrastructure/services')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async deleteAllStatuses(after: (res: AxiosResponse<any>) => void) {
- instance.delete('/ui/status/all/')
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async restartInformers(after: (res: AxiosResponse<any>) => void) {
- instance.put('/ui/infrastructure/informers/')
- .then(res => {
- after(res);
- }).catch(err => {
- after(err);
- });
- }
-
- static async getCamelKamelets(after: (yaml: string) => void) {
- instance.get('/ui/metadata/kamelets', {headers: {'Accept': 'text/plain'}, timeout: 0})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getProjectKamelets(projectId: string, after: (yaml: string) => void) {
- instance.get('/ui/metadata/kamelets/' + projectId, {headers: {'Accept': 'text/plain'}, timeout: 0})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getCustomKamelets(after: (yaml: string) => void) {
- instance.get('/ui/metadata/kamelets/kamelets', {headers: {'Accept': 'text/plain'}, timeout: 0})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getComponents(after: (json: string) => void) {
- instance.get('/ui/metadata/components', {timeout: 0})
- .then(res => {
- if (res.status === 200) {
- after(JSON.stringify(res.data));
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getBeans(after: (json: string) => void) {
- instance.get('/ui/metadata/beans', {timeout: 0})
- .then(res => {
- if (res.status === 200) {
- after(JSON.stringify(res.data));
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getMetadataConfiguration(configName: string, after: (json: string) => void) {
- instance.get(`/ui/metadata/${configName}Configuration`, { timeout: 0 })
- .then(res => {
- if (res.status === 200) {
- after(JSON.stringify(res.data));
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getConfigurationChanges(after: (json: string) => void) {
- instance.get('/ui/metadata/configurationChanges', {timeout: 0})
- .then(res => {
- if (res.status === 200) {
- after(JSON.stringify(res.data));
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getProjectsActivities(after: (activities?: any) => void) {
- instance.get('/ui/activity/projects')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- } else {
- after(undefined);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- after(undefined);
- });
- }
-
- static async getUsersActivities(after: (activities?: any) => void) {
- instance.get('/ui/activity/users')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- } else {
- after(undefined);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- after(undefined);
- });
- }
-
- static async getProjectsLabels(after: (labels?: any) => void) {
- instance.get('/ui/labels')
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- } else {
- after(undefined);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- after(undefined);
- });
- }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/api/LogWatchApi.tsx b/karavan-app/src/main/webui/src/karavan/api/LogWatchApi.tsx
deleted file mode 100644
index 76f9f493..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/LogWatchApi.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {SsoApi} from "@api/auth/SsoApi";
-import {fetchEventSource} from "@microsoft/fetch-event-source";
-import {ProjectEventBus} from "@bus/ProjectEventBus";
-import {AuthApi, getCurrentUser} from "@api/auth/AuthApi";
-
-export class LogWatchApi {
-
- static async fetchData(type: 'container' | 'build' | 'none', podName: string, controller: AbortController) {
- console.log("Fetch Started for: " + podName);
- const fetchData = async () => {
- const headers: Record<string, string> = {
- Accept: "text/event-stream",
- };
- const url = `/ui/logwatch/${type}/${podName}/${getCurrentUser()?.username ?? ""}`;
- if (AuthApi.authType === 'oidc' && SsoApi.keycloak?.token && SsoApi.keycloak?.token?.length > 0) {
- headers.Authorization = "Bearer " + SsoApi.keycloak?.token;
- }
- await fetchEventSource(url, {
- method: "GET", headers: headers, signal: controller.signal, credentials: "include",
- async onopen(response) {
- const ct = response.headers.get("content-type") || "";
- if (response.ok && ct.toLowerCase().startsWith("text/event-stream")) {
- return; // good to go
- }
- // Handle auth and other errors explicitly
- if (response.status === 401) {
- console.warn("SSE unauthorized: session missing/expired.");
- // Optional: trigger a global event/router redirect here
- throw new Error("unauthorized");
- }
- console.error("Unexpected SSE response", response.status, ct);
- throw new Error(`bad-sse-response:${response.status}`);
- },
- onmessage(event) {
- if (event.event !== 'ping') {
- ProjectEventBus.sendLog('add', event.data);
- } else {
- console.log('Logger SSE Ping', event);
- }
- },
- onclose() {
- console.log("Connection closed by the server");
- },
- onerror(err) {
- console.log("There was an error from server", err);
- },
- });
- };
- return fetchData();
- }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/api/NotificationApi.tsx b/karavan-app/src/main/webui/src/karavan/api/NotificationApi.tsx
deleted file mode 100644
index 88732ce7..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/NotificationApi.tsx
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {SsoApi} from "@api/auth/SsoApi";
-import {EventStreamContentType, fetchEventSource} from "@microsoft/fetch-event-source";
-import {EventSourceMessage} from "@microsoft/fetch-event-source/lib/cjs/parse";
-import {KaravanEvent, NotificationEventBus} from "@services/NotificationService";
-import {AuthApi, getCurrentUser} from "@api/auth/AuthApi";
-
-export class NotificationApi {
-
- static getKaravanEvent (ev: EventSourceMessage, type: 'system' | 'user') {
- const eventParts = ev.event?.split(':');
- const event = eventParts?.length > 1 ? eventParts[0] : undefined;
- const className = eventParts?.length > 1 ? eventParts[1] : undefined;
- return new KaravanEvent({id: ev.id, event: event, type: type, className: className, data: JSON.parse(ev.data)});
- }
-
- static onSystemMessage (ev: EventSourceMessage) {
- const ke = NotificationApi.getKaravanEvent(ev, 'system');
- NotificationEventBus.sendEvent(ke);
- }
-
- static onUserMessage (ev: EventSourceMessage) {
- const ke = NotificationApi.getKaravanEvent(ev, 'user');
- NotificationEventBus.sendEvent(ke);
- }
-
- static async notification(controller: AbortController) {
- const fetchData = async () => {
- const headers: any = { Accept: "text/event-stream" };
- if (AuthApi.authType === 'oidc' && SsoApi.keycloak?.token && SsoApi.keycloak?.token?.length > 0) {
- headers.Authorization = "Bearer " + SsoApi.keycloak?.token;
- }
- if (getCurrentUser()) {
- NotificationApi.fetch('/ui/notification/system/' + getCurrentUser()?.username, controller, headers,
- ev => NotificationApi.onSystemMessage(ev));
- NotificationApi.fetch('/ui/notification/user/' + getCurrentUser()?.username, controller, headers,
- ev => NotificationApi.onUserMessage(ev));
- }
- };
- return fetchData();
- };
-
- static async fetch(input: string, controller: AbortController, headers: any, onmessage: (ev: EventSourceMessage) => void) {
- fetchEventSource(input, {
- method: "GET",
- headers: headers,
- signal: controller.signal,
- credentials: "include",
- async onopen(response) {
- if (response.ok && response.headers.get('content-type') === EventStreamContentType) {
- return; // everything's good
- } else if (response.status === 401) {
- console.warn("SSE unauthorized: session missing/expired.");
- // Optional: trigger a global event/router redirect here
- throw new Error("unauthorized");
- } else if (response.status >= 400 && response.status < 500 && response.status !== 429) {
- // client-side errors are usually non-retriable:
- console.error("Server side error ", response);
- // EventBus.sendAlert("Error fetching", `${input} : ${response.statusText}`, "danger");
- } else {
- console.error("Error ", response);
- // EventBus.sendAlert("Error fetching", `${input} : ${response.statusText}`, "danger");
- }
- },
- onmessage(event) {
- if (event.event !== 'ping') {
- onmessage(event);
- } else {
- console.log('Notification SSE Ping', event);
- }
- },
- onclose() {
- console.log("Connection closed by the server");
- },
- onerror(err) {
- console.log("There was an error from server", err);
- },
- });
- }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/api/SearchApi.tsx b/karavan-app/src/main/webui/src/karavan/api/SearchApi.tsx
deleted file mode 100644
index 3e1f441d..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/SearchApi.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import axios from "axios";
-import {ErrorEventBus} from "@bus/ErrorEventBus";
-import {SearchResult} from "@models/SearchModels";
-import {AuthApi} from "@api/auth/AuthApi";
-
-axios.defaults.headers.common['Accept'] = 'application/json';
-axios.defaults.headers.common['Content-Type'] = 'application/json';
-const instance = AuthApi.getInstance();
-
-export class SearchApi {
-
- static async searchAll(string: string, after: (result?: SearchResult[]) => void) {
- const encoded = encodeURIComponent(string);
- instance.get('/ui/search/all/' + encoded)
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- } else {
- after(undefined);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- after(undefined);
- });
- }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/api/SystemApi.tsx b/karavan-app/src/main/webui/src/karavan/api/SystemApi.tsx
deleted file mode 100644
index b801e6d6..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/SystemApi.tsx
+++ /dev/null
@@ -1,194 +0,0 @@
-import axios from "axios";
-import {AuthApi} from "@api/auth/AuthApi";
-import {ErrorEventBus} from "@bus/ErrorEventBus";
-import {KubernetesConfigMap, KubernetesSecret} from "@models/SystemModels";
-import {Buffer} from 'buffer';
-
-axios.defaults.headers.common['Accept'] = 'application/json';
-axios.defaults.headers.common['Content-Type'] = 'application/json';
-const instance = AuthApi.getInstance();
-
-export class SystemApi {
-
- // Secrets
- static async createSecret(secretName: string, after: (val: string) => void) {
- instance.post('/platform/system/secrets/' + Buffer.from(secretName).toString('base64'), {},{headers: {'Content-Type': 'text/plain'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getSecrets(after: (secrets: KubernetesSecret[]) => void) {
- instance.get('/platform/system/secrets', {headers: {'Accept': 'application/json'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async deleteSecret(secretName: string, after: (val: string) => void) {
- instance.delete('/platform/system/secrets/' + Buffer.from(secretName).toString('base64'))
- .then(res => {
- if (res.status === 204) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getSecretValue(secretName: string, secretKey: string, after: (val: string) => void) {
- instance.get('/platform/system/secrets/' + Buffer.from(secretName).toString('base64') + '/' + Buffer.from(secretKey).toString('base64'), {headers: {'Accept': 'application/json'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async setSecretValue(secretName: string, secretKey: string, value: string, after: (val: string) => void) {
- instance.post('/platform/system/secrets/' + Buffer.from(secretName).toString('base64') + '/' + Buffer.from(secretKey).toString('base64'),
- Buffer.from(value, 'binary').toString('base64'),
- {headers: {'Content-Type': 'text/plain'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async deleteSecretValue(secretName: string, secretKey: string, after: (val: string) => void) {
- instance.delete('/platform/system/secrets/' + Buffer.from(secretName).toString('base64') + '/' + Buffer.from(secretKey).toString('base64'))
- .then(res => {
- if (res.status === 204) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- // ConfigMaps
- static async createConfigMap(secretName: string, after: (val: string) => void) {
- instance.post('/platform/system/configmaps/' + Buffer.from(secretName).toString('base64'), {},{headers: {'Content-Type': 'text/plain'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getConfigMaps(after: (secrets: KubernetesConfigMap[]) => void) {
- instance.get('/platform/system/configmaps', {headers: {'Accept': 'application/json'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async deleteConfigMap(configmapName: string, after: (val: string) => void) {
- instance.delete('/platform/system/configmaps/' + Buffer.from(configmapName).toString('base64'))
- .then(res => {
- if (res.status === 204) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getConfigMapValue(configmapName: string, configmapKey: string, after: (val: string) => void) {
- instance.get('/platform/system/configmaps/' + Buffer.from(configmapName).toString('base64') + '/' + Buffer.from(configmapKey).toString('base64'), {headers: {'Accept': 'application/json'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async setConfigMapValue(configmapName: string, configmapKey: string, value: string, after: (val: string) => void) {
- instance.post('/platform/system/configmaps/' + Buffer.from(configmapName).toString('base64') + '/' + Buffer.from(configmapKey).toString('base64'), value, {headers: {'Content-Type': 'text/plain'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async deleteConfigMapValue(configmapName: string, configmapKey: string, after: (val: string) => void) {
- instance.delete('/platform/system/configmaps/' + Buffer.from(configmapName).toString('base64') + '/' + Buffer.from(configmapKey).toString('base64'))
- .then(res => {
- if (res.status === 204) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- // Env Vars
- static async getEnvVars(after: (envVars: string[]) => void) {
- instance.get('/ui/diagnostics/env-vars', {headers: {'Accept': 'application/json'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getEnvVarValue(name: string, after: (val: string) => void) {
- instance.get('/ui/diagnostics/env-vars/' + Buffer.from(name).toString('base64'), {headers: {'Accept': 'application/json'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- // Application Properties
- static async getAppProps(after: (envVars: string[]) => void) {
- instance.get('/ui/diagnostics/app-props', {headers: {'Accept': 'application/json'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static async getAppPropValue(name: string, after: (val: string) => void) {
- instance.get('/ui/diagnostics/app-props/' + Buffer.from(name).toString('base64'), {headers: {'Accept': 'application/json'}})
- .then(res => {
- if (res.status === 200) {
- after(res.data);
- }
- }).catch(err => {
- ErrorEventBus.sendApiError(err);
- });
- }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/api/auth/AuthApi.tsx b/karavan-app/src/main/webui/src/karavan/api/auth/AuthApi.tsx
deleted file mode 100644
index 534ee51d..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/auth/AuthApi.tsx
+++ /dev/null
@@ -1,239 +0,0 @@
-import axios from "axios";
-import {ErrorEventBus} from "@bus/ErrorEventBus";
-import {AccessPassword, AccessUser} from "@models/AccessModels";
-import {SsoApi} from "@api/auth/SsoApi"; // --- axios base ---
-
-// --- axios base ---
-axios.defaults.timeout = 30000;
-axios.defaults.headers.common["Accept"] = "application/json";
-axios.defaults.headers.common["Content-Type"] = "application/json";
-
-const instance = axios.create({ withCredentials: true });
-
-// --- simple state (no tokens) ---
-let currentUser: AccessUser | null = null;
-export function setCurrentUser(u: AccessUser | null) { currentUser = u; }
-export function getCurrentUser() { return currentUser; }
-export function getInstance() { return instance; }
-
-// --- cookies / csrf ---
-const CSRF_COOKIE = "csrf";
-function readCookie(name: string): string | null {
- return document.cookie
- .split("; ")
- .map((p) => p.trim())
- .filter((p) => p.startsWith(name + "="))
- .map((p) => p.substring(name.length + 1))[0] ?? null;
-}
-
-function isNoAuth(cfg: any) {
- const method = (cfg.method || "GET").toUpperCase();
- const url = new URL(cfg.url!, cfg.baseURL || window.location.origin);
- const path = url.pathname;
- // Endpoints where we intentionally skip CSRF/auth headers
- return (
- cfg.headers?.["X-Skip-Auth"] === "1" ||
- method === "OPTIONS" ||
- path.endsWith("/ui/auth/login") ||
- path.endsWith("/ui/auth/logout") ||
- path.endsWith("/health") ||
- path.endsWith("/q/health")
- );
-}
-
-// --- API surface (no tokens involved) ---
-export class AuthApi {
- static authType?: "session" | "oidc";
- static getInstance() {
- return instance;
- }
-
- static async getMe(after: (user: AccessUser) => void) {
- instance
- .get("/ui/auth/me", { withCredentials: true })
- .then((res) => {
- if (res.status === 200) {
- setCurrentUser(res.data);
- after(res.data);
- }
- })
- .catch((err) => {
- // 401 here means "not logged in"
- setCurrentUser(null);
- // optional: bubble error to a global bus/router
- // ErrorEventBus.sendApiError(err);
- });
- }
-
- static async login(
- username: string,
- password: string,
- after: (ok: boolean, res: any) => void
- ) {
- instance
- .post("/ui/auth/login", { username, password }, { withCredentials: true })
- .then((res) => {
- if (res.status === 200) {
- // server may return user; if not, fetch it
- if (res.data?.username) {
- setCurrentUser(res.data.username);
- after(true, res);
- } else {
- AuthApi.getMe(() => after(true, res));
- }
- } else {
- setCurrentUser(null);
- after(false, res);
- }
- })
- .catch((err) => {
- setCurrentUser(null);
- after(false, err);
- });
- }
-
- static async logout() {
- // Tell interceptors to skip CSRF on logout
- instance
- .post(
- "/ui/auth/logout",
- {},
- { withCredentials: true, headers: { "X-Skip-Auth": "1" } }
- )
- .then((res) => {
- if (res.status === 204) {
- setCurrentUser(null);
- }
- })
- .catch((err) => {
- console.error(err);
- setCurrentUser(null);
- });
- }
-
-
- static setPassword(password: AccessPassword, after: (result: boolean, res: any) => void) {
- instance
- .post("/ui/auth/password", password)
- .then((res) => {
- if (res.status === 200 || res.status === 201) after(true, res);
- else after(false, res);
- })
- .catch((err) => {
- console.error(err);
- after(false, err);
- });
- }
-
- // Optional: keep if your UI still reads SSO config (even though auth is session-based)
- static async getSsoConfig(after: (config: {}) => void) {
- instance.get("/ui/auth/sso-config", { headers: { Accept: "application/json" } })
- .then((res) => {
- if (res.status === 200) after(res.data);
- })
- .catch((err) => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- static setAuthType(authType: "session" | "oidc") {
- this.authType = authType;
- switch (authType) {
- case "oidc":
- AuthApi.setOidcAuthentication();
- break;
- case "session":
- AuthApi.setSessionIdAuthentication();
- break;
- }
- }
-
- static async getAuthType(after: (authType: string) => void) {
- instance
- .get("/ui/auth/type", { headers: { Accept: "text/plain" } })
- .then((res) => {
- if (res.status === 200) {
- const authType = res.data as "session" | "oidc";
- AuthApi.setAuthType(authType);
- after(authType);
- }
- })
- .catch((err) => {
- ErrorEventBus.sendApiError(err);
- });
- }
-
- private static setSessionIdAuthentication() {
- // --- request interceptor: add CSRF header on unsafe methods, never set Authorization ---
- instance.interceptors.request.use((cfg: any) => {
- // ensure no Authorization header sneaks in
- if (cfg?.headers?.Authorization) delete cfg.headers.Authorization;
-
- if (!isNoAuth(cfg)) {
- const m = (cfg.method || "GET").toLowerCase();
- const unsafe = m === "post" || m === "put" || m === "patch" || m === "delete";
- if (unsafe) {
- const csrf = readCookie(CSRF_COOKIE);
- if (csrf) cfg.headers = { ...cfg.headers, "X-CSRF-Token": csrf };
- }
- }
- return cfg;
- });
-
-// --- response interceptor: normalize 401 handling ---
- instance.interceptors.response.use(
- (res) => res,
- async (error) => {
- const original = error?.config;
- if (!original) throw error;
-
- if (error?.response?.status === 401 && !original._retry && !isNoAuth(original)) {
- original._retry = true;
- // Session missing/expired → clear user; let caller redirect to /login
- setCurrentUser(null);
- // Optionally: return a rejected promise with a sentinel
- return Promise.reject({ ...error, _auth: "unauthorized" });
- }
-
- return Promise.reject(error);
- }
- );
- }
-
- static setOidcAuthentication() {
- instance.interceptors.request.use(
- async (config) => {
- const token = SsoApi.keycloak?.token;
- if (token) config.headers.Authorization = `Bearer ${token}`;
- return config;
- },
- (error) => Promise.reject(error)
- );
-
- instance.interceptors.response.use(
- (response) => response,
- async (error) => {
- const original = error.config;
- if (!original || original._retry) return Promise.reject(error);
-
- const status = error?.response?.status;
- if ((status === 401 || status === 403) && SsoApi.keycloak) {
- original._retry = true;
- try {
- const refreshed = await SsoApi.keycloak.updateToken(30);
- if (refreshed) {
- original.headers = {
- ...original.headers,
- Authorization: `Bearer ${SsoApi.keycloak.token}`,
- };
- return instance(original);
- }
- } catch (e) {
- // fall-through
- }
- }
- return Promise.reject(error);
- }
- );
- }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/api/auth/AuthProvider.tsx b/karavan-app/src/main/webui/src/karavan/api/auth/AuthProvider.tsx
deleted file mode 100644
index ef2e3033..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/auth/AuthProvider.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-import React, {useCallback, useEffect, useState} from "react";
-// Import all the APIs we need
-import {AuthApi, getCurrentUser} from "@api/auth/AuthApi";
-import {SsoApi} from "@api/auth/SsoApi";
-import {AccessUser} from "@models/AccessModels"; // Assuming AccessUser is here
-
-// We'll add `authType` to the context for consumers
-export const AuthContext = React.createContext({
- user: null as AccessUser | null,
- loading: true,
- authType: null as "session" | "oidc" | null,
- reload: async () => {},
- logout: async () => {},
-});
-
-export function AuthProvider({ children }: { children: React.ReactNode }) {
- const [user, setUser] = useState<AccessUser | null>(null);
- const [loading, setLoading] = useState(true);
- const [authType, setAuthType] = useState<"session" | "oidc" | null>(null);
-
- // This is the main initialization effect.
- // It replaces the simple `useEffect(() => { reload() }, [reload])`
- useEffect(() => {
- let isMounted = true; // Prevent state updates on unmounted component
- // 1. Fetch the authentication type.
- // This call also sets up the correct axios interceptors inside AuthApi.
- AuthApi.getAuthType(type => {
- if (!isMounted) return;
-
- setAuthType(type as "session" | "oidc" | null); // Save the type
-
- if (type === 'oidc') {
- // 2a. OIDC Flow: Initialize Keycloak.
- // SsoApi.auth() handles the 'check-sso' logic.
- SsoApi.auth(() => {
- // This callback runs after Keycloak init (login or silent check)
- if (isMounted) {
- // SsoApi.auth() has updated the global currentUser
- setUser(getCurrentUser());
- setLoading(false);
- }
- });
- } else {
- // 2b. Session Flow: Just call /me to check for an existing cookie.
- AuthApi.getMe(userFromApi => {
- if (isMounted) {
- // AuthApi.getMe() updates global user and returns it
- setUser(userFromApi);
- setLoading(false);
- }
- });
- }
- });
-
- // Cleanup function in case component unmounts during auth
- return () => { isMounted = false; };
- }, []); // Run only once on mount
-
- // The original `reload` was flawed (awaiting a non-promise).
- // This implementation matches the callback-style of AuthApi.getMe.
- const reload = useCallback(async () => {
- setLoading(true);
- // getMe will use the correct interceptor (OIDC or session)
- // because getAuthType() already ran and set it up.
- AuthApi.getMe((u) => {
- setUser(u);
- setLoading(false);
- });
- // We keep the `async` signature to match the context interface,
- // even though the implementation is callback-based.
- }, []);
-
- // The logout function MUST now be conditional
- const logout = useCallback(async () => {
- setLoading(true);
-
- if (authType === 'oidc') {
- // Use OIDC logout
- SsoApi.logout(() => {
- setUser(null);
- setLoading(false);
- // OIDC logout often involves a page redirect,
- // which SsoApi.logout() will trigger.
- });
- } else if (authType === 'session') {
- // Use session logout
- await AuthApi.logout(); // This is async
- setUser(null);
- setLoading(false);
- } else {
- // Fallback if authType isn't set for some reason
- setUser(null);
- setLoading(false);
- }
- }, [authType]); // Re-create this function if authType changes
-
- return (
- <AuthContext.Provider value={{ user, loading, authType, reload, logout }}>
- {children}
- </AuthContext.Provider>
- );
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/api/auth/SsoApi.tsx b/karavan-app/src/main/webui/src/karavan/api/auth/SsoApi.tsx
deleted file mode 100644
index 9a2a0aba..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/auth/SsoApi.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Keycloak from "keycloak-js";
-import {AuthApi, setCurrentUser} from "@api/auth/AuthApi";
-import {AccessUser} from "@models/AccessModels";
-
-export class SsoApi {
-
- static keycloak?: Keycloak;
-
- static auth(after: () => void) {
- AuthApi.getSsoConfig((config: any) => {
- SsoApi.keycloak = new Keycloak({url: config.url, realm: config.realm, clientId: config.clientId});
- SsoApi.keycloak.init({
- flow: "hybrid",
- onLoad: 'login-required',
- silentCheckSsoRedirectUri: `${location.origin}/silent-check-sso.html`
- }).then(authenticated => {
- if (authenticated) {
- const k = SsoApi.keycloak;
- if (k) {
- const userInfo = {
- username: k.tokenParsed?.preferred_username,
- roles: k.tokenParsed?.realm_access?.roles || [],
- };
- console.log('SsoApi', 'User is now authenticated.', userInfo);
- setCurrentUser(userInfo as AccessUser);
- }
- } else {
- console.log('User is not authenticated');
- }
- after();
- }).catch(reason => {
- console.log('SsoApi', 'Error:', reason);
- });
- });
- }
-
- static logout(after: () => void) {
- if (SsoApi.keycloak) {
- SsoApi.keycloak.logout().then(value => {
- console.log('SsoApi', 'User is now logout.');
- setCurrentUser(null)
- }).catch(reason => {
- console.log('SsoApi', 'Error:', reason);
- });
- }
- }
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/app/App.css b/karavan-app/src/main/webui/src/karavan/app/App.css
deleted file mode 100644
index 3bf2ac56..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/App.css
+++ /dev/null
@@ -1,20 +0,0 @@
-.root-main {
- display: flex;
- flex-direction: row;
- height: 100%;
-}
-
-.karavan .loading-page {
- width: 100%;
-}
-.karavan .loading-page .spinner {
- position: absolute;
-}
-.karavan .loading-page .logo-placeholder {
- position: absolute;
- height: 100px;
-}
-
-.karavan .loading-page .logo {
- height: 100px;
-}
diff --git a/karavan-app/src/main/webui/src/karavan/app/App.tsx b/karavan-app/src/main/webui/src/karavan/app/App.tsx
deleted file mode 100644
index a75ee5d1..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/App.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useContext, useEffect, useRef} from "react";
-import './App.css';
-import {mainHook} from "./MainHook";
-import {Notification} from "@features/project/designer/utils/Notification";
-import {NotificationApi} from "@api/NotificationApi";
-import {AuthContext} from "@api/auth/AuthProvider";
-import {AuthApi, getCurrentUser} from "@api/auth/AuthApi";
-import {PLATFORM_DEVELOPER} from "@models/AccessModels";
-import PageNavigation from "@app/navigation/PageNavigation";
-import {MainRoutes} from "@app/navigation/MainRoutes";
-import {ReadinessPanel} from "@app/ReadinessPanel";
-import {useReadinessStore} from "@stores/ReadinessStore";
-import {ErrorEventBus} from "@bus/ErrorEventBus";
-import {useNavigate} from "react-router-dom";
-import {ROUTES} from "@app/navigation/Routes";
-
-export function App() {
-
- const {readiness} = useReadinessStore();
- const controllerRef = useRef(new AbortController());
- const {getData, showApplication} = mainHook();
- const show = showApplication();
- const { user } = useContext(AuthContext);
- const navigate = useNavigate();
-
- useEffect(() => {
- const interval = setInterval(() => resetNotification(), 60000);
- const sub = ErrorEventBus.onApiError()?.subscribe(err => {
- console.log("ApiError", err?.config?.url, err)
- if (err?.response?.status === 401 && AuthApi.authType === 'session') {
- navigate(ROUTES.LOGIN);
- window.location.reload();
- }
- });
- return () => {
- clearInterval(interval);
- sub?.unsubscribe();
- };
- }, []);
-
- useEffect(() => {
- if (showMain()) {
- getData();
- resetNotification();
- }
- }, [readiness, user]);
-
- function resetNotification() {
- try {
- controllerRef.current.abort()
- const controller = new AbortController();
- controllerRef.current = controller;
- NotificationApi.notification(controller);
- } catch (e) {
- console.error(e);
- }
- }
-
- function showMain() {
- return AuthApi.authType !== undefined && readiness?.status === true;
- }
-
- function isViewer(){
- return getCurrentUser()?.roles?.includes(PLATFORM_DEVELOPER);
- }
-
- if (show) {
- return (
- <div className={isViewer() ? "viewer-group root-main karavan" : "root-main karavan"}>
- <ReadinessPanel/>
- {user && <PageNavigation/>}
- <MainRoutes/>
- <Notification/>
- </div>
- )
- } else {
- return (
- <div className={isViewer() ? "viewer-group root-main karavan" : "root-main karavan"}>
- {<ReadinessPanel/>}
- </div>
- )
- }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/app/MainHook.tsx b/karavan-app/src/main/webui/src/karavan/app/MainHook.tsx
deleted file mode 100644
index 09f53db3..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/MainHook.tsx
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import {KaravanApi} from "@api/KaravanApi";
-import {ComponentApi} from "@karavan-core/api/ComponentApi";
-import {AppConfig, Project} from "@models/ProjectModels";
-import {useAppConfigStore, useProjectsStore} from "@stores/ProjectStore";
-import {InfrastructureAPI} from "@features/project/designer/utils/InfrastructureAPI";
-import {shallow} from "zustand/shallow";
-import {ProjectService} from "@services/ProjectService";
-import {SpiBeanApi} from "@karavan-core/api/SpiBeanApi";
-import {MainConfigurationApi} from "@karavan-core/api/MainConfigurationApi";
-import {useContext} from "react";
-import {AuthContext} from "@api/auth/AuthProvider";
-import {useReadinessStore} from "@stores/ReadinessStore";
-import {AuthApi} from "@api/auth/AuthApi";
-import {useContainerStatusesStore} from "@stores/ContainerStatusesStore";
-
-export function mainHook () {
-
- const {readiness} = useReadinessStore();
- const [setConfig, setDockerInfo] = useAppConfigStore((s) => [s.setConfig, s.setDockerInfo], shallow)
- const [setProjects] = useProjectsStore((s) => [s.setProjects], shallow)
- const {fetchContainers} = useContainerStatusesStore();
- const [selectedEnv, selectEnvironment] = useAppConfigStore((state) => [state.selectedEnv, state.selectEnvironment], shallow)
- const { user } = useContext(AuthContext);
-
- const getStatuses = () => {
- if (user) {
- fetchContainers();
- }
- }
-
- const getData = () => {
- if (user) {
- KaravanApi.getConfiguration((config: AppConfig) => {
- setConfig(config);
- if (!selectedEnv || selectedEnv.length == 0) {
- selectEnvironment(config.environment, true);
- }
- if (config.infrastructure !== 'kubernetes') {
- KaravanApi.getInfrastructureInfo((info: any) => {
- setDockerInfo(info)
- })
- }
- InfrastructureAPI.infrastructure = config.infrastructure;
- });
- KaravanApi.getProjects((projects: Project[]) => {
- setProjects(projects);
- });
- updateComponents();
- updateBeans();
- updateAllConfigurations();
- ProjectService.loadCamelAndCustomKamelets();
- }
- }
-
- async function updateComponents(): Promise<void> {
- await new Promise(resolve => {
- KaravanApi.getComponents(code => {
- const components: [] = JSON.parse(code);
- const jsons: string[] = [];
- components.forEach(c => jsons.push(JSON.stringify(c)));
- ComponentApi.saveComponents(jsons, true);
- })
- });
- }
-
- async function updateBeans(): Promise<void> {
- await new Promise(resolve => {
- KaravanApi.getBeans(code => {
- const beans: [] = JSON.parse(code);
- const jsons: string[] = [];
- beans.forEach(c => jsons.push(JSON.stringify(c)));
- SpiBeanApi.saveSpiBeans(jsons, true);
- })
- });
- }
-
- async function updateConfiguration(configName: string): Promise<{ properties: any[]; groups: any[] }> {
- return new Promise(resolve => {
- KaravanApi.getMetadataConfiguration(configName, code => {
- try {
- const objects: any = JSON.parse(code);
- const properties: any[] = objects.properties || [];
- const groups: any[] = objects.groups || [];
- resolve({ properties, groups });
- } catch (error) {
- console.error(`Failed to parse configuration for "${configName}":`, error);
- resolve({ properties: [], groups: [] });
- }
- });
- });
- }
-
- async function updateConfigurationChanges(): Promise<any[]> {
- return new Promise(resolve => {
- KaravanApi.getConfigurationChanges(code => {
- const changes: any = JSON.parse(code);
- resolve(changes);
- });
- });
- }
-
- async function updateAllConfigurations(): Promise<void> {
- const [meta, jbang, jib, jkube, changes] = await Promise.all([
- updateConfiguration("main"),
- updateConfiguration("jbang"),
- updateConfiguration("jib"),
- updateConfiguration("jkube"),
- updateConfigurationChanges()
- ]);
-
- const properties: any[] = [...meta.properties, ...jbang.properties, ...jib.properties, ...jkube.properties]
- const groups: any[] = [...meta.groups, ...jbang.groups, ...jib.groups, ...jkube.groups]
-
- MainConfigurationApi.saveApplicationProperties(properties, true);
- MainConfigurationApi.saveApplicationPropertyGroups(groups);
- MainConfigurationApi.saveApplicationPropertyChanges(changes);
- }
-
- function showSpinner() {
- return readiness === undefined;
- }
-
- function showStepper() {
- return readiness !== undefined && readiness.status !== true;
- }
-
- function showApplication() {
- return AuthApi.authType !== undefined && readiness?.status === true;
- }
-
-
- return { getData, getStatuses, showSpinner, showStepper, showApplication };
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/app/ReadinessPanel.tsx b/karavan-app/src/main/webui/src/karavan/app/ReadinessPanel.tsx
deleted file mode 100644
index 9f75b8d0..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/ReadinessPanel.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from "react";
-import './App.css';
-import {useReadinessStore} from "@stores/ReadinessStore";
-import {useDataPolling} from "@shared/polling/useDataPolling";
-import {Bullseye, Content, ContentVariants, Flex, FlexItem, ProgressStep, ProgressStepper, Spinner, Tooltip, TooltipPosition} from "@patternfly/react-core";
-import {mainHook} from "@app/MainHook";
-import {KaravanIcon} from "@features/project/designer/icons/KaravanIcons";
-import {PlatformLogoBase64} from "@app/navigation/PlatformLogo";
-
-const FAST_INTERVAL = 1000; // 1 second (when not ready)
-const SLOW_INTERVAL = 10000; // 10 seconds (when ready)
-
-export function ReadinessPanel() {
-
- const { readiness, fetchReadiness } = useReadinessStore();
- const isReady = readiness && readiness.status === true;
- const currentInterval = isReady ? SLOW_INTERVAL : FAST_INTERVAL;
- useDataPolling('readiness', fetchReadiness, currentInterval);
- const {showSpinner, showStepper} = mainHook();
-
- function getStepper() {
- const steps: any[] = Array.isArray(readiness?.checks) ? readiness.checks : [];
- return (
- <Bullseye className="loading-page">
- <Flex direction={{default: "column"}} justifyContent={{default: "justifyContentCenter"}}>
- <FlexItem style={{textAlign: "center"}}>
- <img src={PlatformLogoBase64()} className="logo" alt='logo'/>
- <Content>
- <Content component={ContentVariants.h2}>
- Waiting for services
- </Content>
- </Content>
- </FlexItem>
- <FlexItem>
- <ProgressStepper aria-label="Readiness progress" isCenterAligned isVertical>
- {steps.map(step => (
- <ProgressStep
- key={step.name}
- variant={step.status === 'UP' ? "success" : "info"}
- isCurrent={step.status !== 'UP'}
- icon={step.status !== 'UP' ? <Spinner isInline aria-label="Loading..."/> : undefined}
- id={step.name}
- titleId={step.name}
- aria-label={step.name}
- >
- {step.name}
- </ProgressStep>
- ))}
- </ProgressStepper>
- </FlexItem>
- </Flex>
- </Bullseye>
- )
- }
-
- function getSpinner() {
- return (
- <Bullseye className="loading-page">
- <Spinner className="spinner" diameter="140px" aria-label="Loading..."/>
- <Tooltip content="Connecting to server..." position={TooltipPosition.bottom}>
- <div className="logo-placeholder">{KaravanIcon()}</div>
- </Tooltip>
- </Bullseye>
- )
- }
-
- return (
- <>
- {showSpinner() && getSpinner()}
- {showStepper() && getStepper()}
- </>
- )
-}
diff --git a/karavan-app/src/main/webui/src/karavan/app/login/LoginPage.css b/karavan-app/src/main/webui/src/karavan/app/login/LoginPage.css
deleted file mode 100644
index 3b1c25ee..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/login/LoginPage.css
+++ /dev/null
@@ -1,333 +0,0 @@
-.karavan-container {
- display: flex;
- flex-direction: row;
- justify-content: space-evenly;
- align-items: center;
- height: 100vh;
- width: 100vw;
- overflow: hidden;
-}
-
-/* --- LEFT PANEL: Branding --- */
-.karavan-brand-panel {
- width: 35%;
- height: 100vh;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- background: var(--pf-t--color--gray--95);
- gap: 48px;
- h1 {
- color: var(--pf-t--color--blue--30);
- }
-}
-
-.brand-content {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 100%;
-
- .brand-name {
- display: flex;
- flex-direction: column;
- justify-content: center;
- gap: 20px;
-
- .brand-logo-container {
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 12px;
-
- .logo {
- height: 40px;
- width: 40px;
- }
- .platform-name-text {
- font-size: 24px;
- font-weight: 700;
- letter-spacing: 1px;
- }
- }
- .gradient-text-blue {
- background: linear-gradient(to right, #4394e5, #92c5f9);
-
- -webkit-background-clip: text; /* Safari / Chrome */
- background-clip: text;
- color: transparent;
- }
- .gradient-text-blue-gold {
- background: linear-gradient(to right, #fda422, #ec7a08);
-
- -webkit-background-clip: text; /* Safari / Chrome */
- background-clip: text;
- color: transparent;
- }
- .gradient-text-gold {
- background: linear-gradient(to right, #ec7a08, #db5b04);
-
- -webkit-background-clip: text; /* Safari / Chrome */
- background-clip: text;
- color: transparent;
- }
-
- .tagline1 {
- font-weight: 800;
- font-size: 56px;
- line-height: 1.1;
- text-align: center;
- }
-
- .tagline2 {
- font-weight: 400;
- line-height: 1.5;
- font-size: 22px;
- letter-spacing: 0.5px;
- margin-top: 16px;
- text-align: center;
- }
- }
-}
-
-.solar-content {
- display: flex;
- flex-direction: column;
- justify-content: center;
- gap: 8px;
- /* Container that holds both the center logo and the ring */
- .solar-system {
- position: relative;
- width: 350px; /* Width of the whole system */
- height: 350px;
- margin: 0 auto;
- display: flex;
- flex-direction: column;
- justify-content: flex-end;
- }
-}
-
-.orbit-lines-svg {
- position: absolute;
- top: 0;
- left: 0;
- transform: translate(-50%, -50%);
- width: 350px; /* Must match SVG viewBox width */
- height: 350px; /* Must match SVG viewBox height */
- z-index: 1; /* Lowest level, behind icons */
- pointer-events: none; /* Let clicks pass through to the logo */
-
- /* OPTIONAL: Rotate the gradient slowly for extra "flash" */
- animation: slowSpin 20s linear infinite;
-}
-
-/* Ensure your icons are on top */
-.orbit-ring {
- z-index: 5;
-}
-
-/* 1. THE STATIC CENTER LOGO */
-.static-sun {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%); /* Perfectly centered */
- width: 100px;
- height: 100px;
- z-index: 10; /* Ensures it sits ON TOP of the ring lines */
-
- /* Optional: A nice glow behind the main logo */
- background: radial-gradient(
- circle,
- rgba(236, 122, 8, 0.4) 0%,
- rgba(236, 122, 8, 0) 60%
- );
- border-radius: 50%;
- display: flex;
- justify-content: center;
- align-items: center;
-}
-
-.static-sun a {
- pointer-events: auto;
- width: 48px; /* Your actual logo size */
- height: 48px;
- display: flex;
- justify-content: center;
- align-items: center;
- transition: transform 0.3s ease, filter 0.3s ease;
- &:hover {
- transform: scale(1.1);
- }
-}
-
-.static-sun .logo {
- width: 100%; /* Adjust to fit inside the glow */
- height: auto;
- filter: none;
-}
-
-/* 1. The Ring spins clockwise */
-.orbit-ring {
- width: 100%;
- height: 100%;
- position: absolute;
- animation: slowSpin 60s linear infinite;
-}
-
-/* 2. The Item is placed on the ring (Static Position) */
-.orbit-item {
- position: absolute;
- top: 50%;
- left: 50%;
- width: 32px; /* Adjusted size */
- height: 32px;
- margin-top: -16px;
- margin-left: -16px;
-
- /* Logic: Rotate to angle -> Move out -> Rotate back to upright */
- transform:
- rotate(var(--angle))
- translate(var(--radius))
- rotate(calc(var(--angle) * -1));
-}
-
-/* 3. The Counter-Rotator spins Counter-Clockwise
- This cancels out the ring's rotation so the icon always faces North */
-.counter-rotator {
- width: 100%;
- height: 100%;
- animation: slowSpinReverse 60s linear infinite;
-}
-
-/* 4. The Image handles ONLY the look and hover scale */
-.counter-rotator img,
-.counter-rotator svg {
- display: block;
- width: 100%;
- height: 100%;
- object-fit: contain;
-
- /* Look */
- /*filter: grayscale(100%);*/
- transition: transform 0.3s ease, filter 0.3s ease;
-}
-
-/* Hover Effect: Scale the image, NOT the rotating wrapper */
-.counter-rotator:hover img,
-.counter-rotator:hover svg {
- filter: none;
- transform: scale(1.2);
-}
-
-/* --- Keyframes --- */
-@keyframes slowSpin {
- from { transform: rotate(0deg); }
- to { transform: rotate(360deg); }
-}
-
-@keyframes slowSpinReverse {
- /* Must match the ring's speed but in REVERSE */
- from { transform: rotate(360deg); }
- to { transform: rotate(0deg); }
-}
-
-.anchor-line {
- width: 1px;
- height: 50px; /* Length of line */
- background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 10%, rgba(236, 122, 8, 1) 50%, rgba(255, 255, 255, 0.1) 100%);
- margin: 0 auto 8px auto; /* Center it and add space below */
-}
-
-.brand-footer {
- opacity: 0.6;
- font-size: 0.85rem;
- letter-spacing: 1px;
- text-transform: uppercase;
- text-align: center;
- color: var(--pf-t--color--blue--10);
- padding-bottom: 60px;
-}
-
-/* --- RIGHT PANEL: Minimal Form --- */
-.karavan-form-panel {
- width: 65%;
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: center;
-}
-
-.form-wrapper {
- width: 100%;
- max-width: 400px;
- padding: 20px;
-
- .login {
- &::before {
- position: absolute;
- inset: 0;
- pointer-events: none;
- content: "";
- border-color: var(--pf-t--color--blue--60);
- border-style: var(--pf-v6-c-card--BorderStyle);
- border-width: var(--pf-v6-c-card--BorderWidth);
- border-radius: inherit;
- }
-
- .login-header {
- color: var(--pf-t--global--text--color--subtle);
- }
-
- .environment-dev {
- background-color: var(--pf-t--global--text--color--brand--default);
- }
- .environment-default {
- background-color: var(--pf-t--global--icon--color--status--warning--default);
- }
- .environment-prod {
- background-color: var(--pf-t--global--icon--color--status--danger--default);
- }
- }
-
- .pf-v6-c-form-control, .pf-v6-c-text-input-group {
- /*background-color: transparent;*/
- }
-
- .pf-v6-c-card__header, .pf-v6-c-card__title, .pf-v6-c-card__body {
- padding-block-end: var(--pf-t--global--spacer--xl);
- }
-
- .pf-v6-c-card__footer {
- padding-block-end: var(--pf-t--global--spacer--md);
- }
-
- .platform-version {
- color: var(--pf-t--global--text--color--subtle);
- font-size: var(--pf-t--global--font--size--xs);
- }
-
- .button {
- width: 100%;
- }
-
- .button-disabled {
- opacity: 0.5;
- cursor: not-allowed;
- }
-}
-
-.powered-by-logo {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
-
-
- .logo, .icon{
- width: 32px;
- height: 32px;
- }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/app/login/LoginPage.tsx b/karavan-app/src/main/webui/src/karavan/app/login/LoginPage.tsx
deleted file mode 100644
index 8a22b7be..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/login/LoginPage.tsx
+++ /dev/null
@@ -1,214 +0,0 @@
-import React, {useContext, useEffect} from 'react';
-import {
- Alert,
- Button,
- Card,
- CardBody,
- CardFooter,
- CardHeader,
- Content,
- Form,
- FormAlert,
- FormGroup,
- TextInput,
- TextInputGroup,
- TextInputGroupMain,
- TextInputGroupUtilities
-} from '@patternfly/react-core';
-import './LoginPage.css'
-import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon';
-import EyeSlashIcon from '@patternfly/react-icons/dist/esm/icons/eye-slash-icon';
-import {AuthContext} from "@api/auth/AuthProvider";
-import {AuthApi} from "@api/auth/AuthApi";
-import {CamelIcon} from "@features/project/designer/icons/KaravanIcons";
-import {PlatformVersion} from "@shared/ui/PlatformLogos";
-import PlatformLogo from "@app/navigation/PlatformLogo";
-import OrbitLines from "@app/login/OrbitLines";
-import {useReadinessStore} from "@stores/ReadinessStore";
-
-export const LoginPage: React.FunctionComponent = () => {
-
- const [username, setUsername] = React.useState('');
- const [password, setPassword] = React.useState('');
- const [passwordHidden, setPasswordHidden] = React.useState(true);
- const [showError, setShowError] = React.useState(false);
- const [error, setError] = React.useState('');
- const {reload} = useContext(AuthContext);
- const { readiness } = useReadinessStore();
-
- useEffect(() => {
- }, []);
-
- function onLoginButtonClick(event: any) {
- if (!getButtonDisabled()) {
- event.preventDefault();
- AuthApi.login(username, password, (ok, res) => {
- if (!ok) {
- setError(res?.response?.data);
- setShowError(true);
- } else {
- setError('');
- setShowError(false);
- reload();
- }
- })
- }
- }
-
- function getButtonDisabled(): boolean {
- return (username?.length < 3 || password?.length < 3);
- }
-
- function onKeyDown(event: React.KeyboardEvent<HTMLFormElement>): void {
- event.stopPropagation();
- if (event.key === 'Enter') {
- event.preventDefault();
- onLoginButtonClick(event);
- }
- }
-
- function getCamel() {
- return (
- <div className="powered-by-logo counter-rotator">
- <a href="https://camel.apache.org/" target="_blank">{CamelIcon()}</a>
- </div>
- )
- }
-
- function getLogos() {
- return [
- getCamel(),
- getCamel(),
- getCamel(),
- getCamel(),
- getCamel(),
- getCamel(),
- getCamel(),
- getCamel(),
- getCamel(),
- getCamel()
- ];
- }
-
- const LOGOS = getLogos();
-
- function getLoginForm() {
- return (
- <Form onKeyDown={onKeyDown}>
- <FormGroup fieldId="username">
- <TextInput className="text-field"
- type="text"
- id="username"
- name="username"
- value={username}
- placeholder={"Username"}
- onChange={(_, value) => setUsername(value)}/>
- </FormGroup>
- <FormGroup fieldId="password">
- <TextInputGroup>
- <TextInputGroupMain className="text-field"
- type={passwordHidden ? "password" : 'text'}
- id="password"
- name="password"
- value={password}
- placeholder={"Password"}
- onChange={(_, value) => setPassword(value)}
- />
- <TextInputGroupUtilities>
- <Button
- variant="plain"
- onClick={() => setPasswordHidden(!passwordHidden)}
- aria-label={passwordHidden ? 'Show password' : 'Hide password'}
- >
- {passwordHidden ? <EyeIcon/> : <EyeSlashIcon/>}
- </Button>
- </TextInputGroupUtilities>
- </TextInputGroup>
- </FormGroup>
- {showError && (
- <FormAlert>
- <Alert variant="danger" title={<div>{error?.toString()}</div>} aria-live="polite" isInline/>
- </FormAlert>
- )}
- </Form>
- )
- }
-
-
- function getRightSide() {
- const buttonClassName = getButtonDisabled() ? "button button-disabled" : "button";
- return (
- <div className="karavan-form-panel dark-form">
- <div className="form-wrapper">
- <Card className="login" isLarge>
- <CardHeader>
- <div style={{display: "flex", flexDirection: 'row', justifyContent: 'space-between', alignItems: "center"}}>
- <Content component='h3' className="login-header">Login</Content>
- <PlatformVersion environment={readiness?.environment}/>
- </div>
- </CardHeader>
- <CardBody>
- {getLoginForm()}
- </CardBody>
- <CardFooter style={{ textAlign: "center" }}>
- <Button variant="primary"
- className={buttonClassName}
- onClick={onLoginButtonClick}
- >
- Access Platform
- </Button>
- </CardFooter>
- </Card>
- {/*<DarkModeToggle/>*/}
- </div>
- </div>
- )
- }
-
- function getLeftSide() {
- return (
- <div className="karavan-brand-panel">
- <div className="brand-content">
- <div className="brand-name">
- <div>
- <div className="tagline1 gradient-text-blue">Apache</div>
- <div className="tagline1 gradient-text-blue">Camel</div>
- <div className="tagline1 gradient-text-blue">Karavan</div>
- </div>
- <Content component='p' className="tagline2 gradient-text-blue-gold">Low-Code Data Integration Platform</Content>
- </div>
- </div>
- <div className="solar-content">
- <div className="solar-system">
- <OrbitLines />
- <div className="static-sun">
- <a href="" target="_blank">
- {PlatformLogo("logo")}
- </a>
- </div>
- <div className="orbit-ring">
- {LOGOS.map((logo, index) => {
- const total = LOGOS.length;
- const angle = (360 / total) * index;
- const radius = 150;
- const style = {'--angle': `${angle}deg`, '--radius': `${radius}px`,} as React.CSSProperties;
- return (
- <div key={index} className="orbit-item" style={style}>
- {logo}
- </div>
- );
- })}
- </div>
- </div>
- </div>
- </div>
- )
- }
-
- return (
- <div className="karavan-container">
- {getLeftSide()}
- {getRightSide()}
- </div>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/app/login/OrbitLines.tsx b/karavan-app/src/main/webui/src/karavan/app/login/OrbitLines.tsx
deleted file mode 100644
index 544466a1..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/login/OrbitLines.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-
-const OrbitLines = () => {
- return (
- <svg
- className="orbit-lines-svg"
- viewBox="0 0 400 400"
- xmlns="http://www.w3.org/2000/svg"
- >
- <defs>
- {/* The Magic Gradient: Orange to Transparent to Blue */}
- <linearGradient id="orbit-grad" x1="0%" y1="0%" x2="100%" y2="100%">
- <stop offset="0%" stopColor="#ec7a08" stopOpacity="1" />
- <stop offset="50%" stopColor="#f97316" stopOpacity="0.5" />
- <stop offset="100%" stopColor="#0066cc" stopOpacity="1" />
- </linearGradient>
-
- {/* The Glow Effect */}
- <filter id="glow">
- <feGaussianBlur stdDeviation="2.5" result="coloredBlur" />
- <feMerge>
- <feMergeNode in="coloredBlur" />
- <feMergeNode in="SourceGraphic" />
- </feMerge>
- </filter>
- </defs>
-
- {/* Outer Ring (Matches your icon radius of 150px) */}
- <circle
- cx="200" cy="200" r="170"
- fill="none"
- stroke="url(#orbit-grad)"
- strokeWidth="2"
- filter="url(#glow)"
- opacity="1"
- />
-
- {/* Inner Decorative Ring (Smaller, thinner) */}
- <circle
- cx="200" cy="200" r="130"
- fill="none"
- stroke="url(#orbit-grad)"
- strokeWidth="1"
- strokeDasharray="10 10" /* Makes it dashed/techy */
- filter="url(#glow)"
- opacity="0.5"
- />
- </svg>
- );
-};
-
-export default OrbitLines;
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/app/login/UserPopupOidc.tsx b/karavan-app/src/main/webui/src/karavan/app/login/UserPopupOidc.tsx
deleted file mode 100644
index 1498d6a9..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/login/UserPopupOidc.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import React from 'react';
-import {Badge, Content, ContentVariants, DescriptionList, DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, Flex, Popover,} from '@patternfly/react-core';
-import UserIcon from "@patternfly/react-icons/dist/esm/icons/user-icon";
-import {shallow} from "zustand/shallow";
-import {useAccessStore} from "@stores/AccessStore";
-import {getCurrentUser} from "@api/auth/AuthApi";
-
-export function UserPopupOidc() {
-
- const [setShowUserModal, showUserModal] = useAccessStore((s) => [s.setShowUserModal, s.showUserModal], shallow);
-
- return (
- <Popover
- hasAutoWidth
- aria-label="Current user"
- position={"right-end"}
- hideOnOutsideClick={false}
- isVisible={showUserModal}
- shouldClose={(_event, tip) => setShowUserModal(false)}
- shouldOpen={(_event, tip) => setShowUserModal(true)}
- headerContent={
- <Content>
- <Content component={ContentVariants.h3}>Profile</Content>
- </Content>
- }
- bodyContent={
- <DescriptionList isHorizontal className='description-align-center'>
- <DescriptionListGroup>
- <DescriptionListTerm>UserName:</DescriptionListTerm>
- <DescriptionListDescription>{getCurrentUser()?.username}</DescriptionListDescription>
- </DescriptionListGroup>
- <DescriptionListGroup>
- <DescriptionListTerm>Roles:</DescriptionListTerm>
- <DescriptionListDescription>
- <Flex direction={{default: "column"}} gap={{default: "gapXs"}}>
- {getCurrentUser()?.roles && Array.isArray(getCurrentUser()?.roles)
- && getCurrentUser()?.roles.map((role: string) => <Badge key={role} id={role}
- isRead>{role}</Badge>)}
- </Flex>
- </DescriptionListDescription>
- </DescriptionListGroup>
- </DescriptionList>
- }
- >
- <div style={{alignSelf: 'center'}}>
- <UserIcon className="avatar"/>
- </div>
- </Popover>
-)
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/app/navigation/MainRoutes.tsx b/karavan-app/src/main/webui/src/karavan/app/navigation/MainRoutes.tsx
deleted file mode 100644
index 504a2a7d..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/navigation/MainRoutes.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import {Navigate, Route, Routes} from 'react-router-dom';
-import React from "react";
-import {NotAuthorizedPage} from "@app/navigation/NotAuthorizedPage";
-import {SystemPage} from "@features/system/SystemPage";
-import {AccessPage} from "@features/access/AccessPage";
-import {DocumentationPage} from "@features/documentation/DocumentationPage";
-import {ROUTES} from "./Routes";
-import {ProtectedRoute} from "@app/navigation/ProtectedRoute";
-import {ProjectFunctionHook} from "@app/navigation/ProjectFunctionHook";
-import {ProjectProvider} from "@features/project/ProjectContext";
-import {DeveloperManager} from "@features/project/developer/DeveloperManager";
-import ProjectPage from "@features/project/ProjectPage";
-import {ProjectsPage} from "@features/projects/ProjectsPage";
-import {LoginPage} from "@app/login/LoginPage";
-import {SettingsPage} from "@features/settings/SettingsPage";
-
-export function MainRoutes() {
-
- return (
- <Routes>
- <Route path={ROUTES.LOGIN} element={
- <ProtectedRoute>
- <LoginPage/>
- </ProtectedRoute>}
- />
- <Route path={ROUTES.PROJECTS} element={
- <ProtectedRoute>
- <ProjectProvider useProjectHook={ProjectFunctionHook}>
- <ProjectsPage key="integrations"/>
- </ProjectProvider>
- </ProtectedRoute>
- }/>
- <Route path={ROUTES.PROJECT_DETAIL} element={
- <ProtectedRoute>
- <ProjectProvider useProjectHook={ProjectFunctionHook}>
- <ProjectPage key="project" developerManager={<DeveloperManager/>}/>
- </ProjectProvider>
- </ProtectedRoute>
- }/>
- <Route path={ROUTES.PROJECT_FILE} element={
- <ProtectedRoute>
- <ProjectProvider useProjectHook={ProjectFunctionHook}>
- <ProjectPage key="project" developerManager={<DeveloperManager/>}/>
- </ProjectProvider>
- </ProtectedRoute>
- }/>
- <Route path={ROUTES.SETTINGS} element={
- <ProtectedRoute>
- <ProjectProvider useProjectHook={ProjectFunctionHook}>
- <SettingsPage/>
- </ProjectProvider>
- </ProtectedRoute>
- }/>
- <Route path={ROUTES.SETTINGS_FILE} element={
- <ProtectedRoute>
- <ProjectProvider useProjectHook={ProjectFunctionHook}>
- <SettingsPage/>
- </ProjectProvider>
- </ProtectedRoute>
- }/>
- <Route path={ROUTES.SYSTEM} element={<ProtectedRoute><SystemPage/></ProtectedRoute>}/>
- <Route path={ROUTES.DOCUMENTATION} element={<ProtectedRoute><DocumentationPage/></ProtectedRoute>}/>
- <Route path={ROUTES.ACL} element={<ProtectedRoute><AccessPage/></ProtectedRoute>}/>
- <Route path={ROUTES.FORBIDDEN} element={<NotAuthorizedPage/>}/>
- {/*{readiness?.environment === 'dev' && <Route path="*" element={<Navigate to={ROUTES.PROJECTS} replace/>}/>}*/}
- <Route path="*" element={<Navigate to={ROUTES.PROJECTS} replace/>}/>
- </Routes>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/app/navigation/NavigationMenu.tsx b/karavan-app/src/main/webui/src/karavan/app/navigation/NavigationMenu.tsx
deleted file mode 100644
index 6ee1f728..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/navigation/NavigationMenu.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import {AuthApi, getCurrentUser} from "@api/auth/AuthApi";
-import React from "react";
-import {SvgNavigationIcon} from "@shared/icons/SvgNavigationIcon";
-import {KubernetesIcon} from "@features/project/designer/icons/ComponentIcons";
-import {DockerIcon} from "@patternfly/react-icons";
-
-export class MenuItem {
- pageId: string = '';
- name: string = '';
- icon: any;
-
- constructor(pageId: string, name: string, icon: any) {
- this.pageId = pageId;
- this.name = name;
- this.icon = icon;
- }
-}
-
-export function getNavigationFirstMenu(): MenuItem[] {
- return [
- new MenuItem("projects", "Projects", SvgNavigationIcon({icon: 'apps'})),
- new MenuItem("settings", "Settings", SvgNavigationIcon({icon: 'settings'})),
- ]
-}
-
-
-export function getNavigationSecondMenu(environment: string, infrastructure: string): MenuItem[] {
- const iconInfra = infrastructure === 'kubernetes' ? KubernetesIcon("infra-icon-k8s") : <DockerIcon className='infra-icon-docker'/>;
-
- const pages: MenuItem[] = []
-
- if (environment === 'dev') {
- pages.push(new MenuItem("documentation", "Learn", SvgNavigationIcon({icon: 'documentation'})));
- }
-
- if (getCurrentUser()?.roles?.includes('platform-admin')) {
- pages.push(new MenuItem("system", "System", iconInfra));
- }
-
- if (AuthApi.authType === 'session') {
- pages.push(new MenuItem("acl", "Access", SvgNavigationIcon({icon: 'access'})));
- }
-
- pages.push(new MenuItem("logout", "Logout", SvgNavigationIcon({icon: 'logout'})));
-
- return pages;
-}
-
diff --git a/karavan-app/src/main/webui/src/karavan/app/navigation/NotAuthorizedPage.tsx b/karavan-app/src/main/webui/src/karavan/app/navigation/NotAuthorizedPage.tsx
deleted file mode 100644
index 95db9777..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/navigation/NotAuthorizedPage.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect} from "react";
-import {Bullseye, EmptyState, EmptyStateBody, EmptyStateVariant} from "@patternfly/react-core";
-import NotAuthorizedIcon from "@patternfly/react-icons/dist/esm/icons/user-secret-icon";
-import {useNavigate} from "react-router-dom";
-import {getCurrentUser} from "@api/auth/AuthApi";
-
-export function NotAuthorizedPage() {
-
- const navigate = useNavigate();
-
- useEffect(() => {
- const roles = getCurrentUser()?.roles ?? [];
- const authorized = roles?.length > 0;
- if (authorized) {
- navigate("/");
- }
- }, []);
-
- return (
- <Bullseye>
- <EmptyState headingLevel="h4" icon={NotAuthorizedIcon} titleText="Not authorized" variant={EmptyStateVariant.xl}>
- <EmptyStateBody>You are not authorize to use this application</EmptyStateBody>
- </EmptyState>
- </Bullseye>
- )
-}
diff --git a/karavan-app/src/main/webui/src/karavan/app/navigation/PageNavigation.css b/karavan-app/src/main/webui/src/karavan/app/navigation/PageNavigation.css
deleted file mode 100644
index 6c4b9d6d..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/navigation/PageNavigation.css
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.karavan .nav-buttons {
- width: fit-content;
- display: flex;
- flex-direction: column;
- height: 100%;
- justify-content: space-between;
- background: var(--pf-t--color--gray--95);
-}
-
-.karavan .nav-buttons .nav-button-part-wrapper,
-.karavan .nav-buttons .nav-button-part-darkmode {
- display: flex;
- flex-direction: column;
- align-items: center;
- position: relative;
-}
-
-.karavan .nav-buttons .environment-wrapper {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- margin-bottom: 8px;
- gap: 3px;
- color: var(--pf-t--color--blue--10);
- /*margin-top: 6px;*/
-
- .version {
- color: var(--pf-t--color--gray--30);
- }
-
- .environment {
- padding: 0 4px 0 4px;
- border-color: #4bb9ecff;
- color: var(--pf-t--color--gray--95);
- background-color: #4bb9ecff;
- font-weight: normal;
- }
-
- .environment-line {
- display: flex;
- flex-direction: row;
- gap: 3px;
- align-items: center;
- }
-
- .login-logo {
- width: 18px;
- height: 18px;
- }
-
- .icon {
- width: 16px;
- height: 16px;
- }
-}
-
-.karavan .nav-buttons .logo {
- margin-top: 6px;
- padding-left: 3px;
- /*margin-bottom: 6px;*/
- width: 64px;
- height: 64px;
-}
-
-.karavan .nav-buttons .pf-v6-c-button svg {
- width: 16px;
- height: 16px;
- fill: #4bb9ec;
-}
-
-/* Adapt navigation for screens less than 800px */
-@media screen and (max-height: 800px) {
- .karavan .nav-buttons .nav-button {
- /*padding: 16px 12px 16px 12px;*/
- }
-
- .karavan .nav-buttons .pf-v6-c-button {
- font-size: 12px;
- }
-}
-
-.karavan .nav-buttons .avatar {
- width: 32px;
- height: 32px;
- border: solid var(--pf-t--color--gray--60) 1px;
- border-radius: 32px;
- padding: 8px;
- background-color: var(--pf-t--color--gray--60);
-}
-
-.karavan .nav-buttons .nav-button {
- border-top-width: 1px;
- border-top-style: solid;
- border-top-color: var(--pf-t--color--gray--80);
- border-radius: 0;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- gap: 4px;
- padding: 10px 10px 10px 10px;
- color: var(--pf-t--color--blue--10);
- &:hover {
- background: color-mix(in srgb, var(--pf-t--color--blue--60) 50%, transparent);
- }
-
- .pf-v6-c-button__text {
-
- }
- .nav-button-badge {
- position: absolute;
- top: 3px;
- right: 3px;
- margin: 0;
- .pf-v6-c-badge {
- padding: 0 6px;
- min-width: fit-content;
- background-color: var(--pf-t--color--orange--40);
- color: var(--pf-t--color--gray--95);
- font-weight: normal;
- }
- }
-}
-
-.karavan .nav-buttons .nav-button .pf-v6-c-button__icon.pf-m-start {
- margin-inline-end: initial;
-}
-
-.karavan .nav-buttons .nav-button-last {
- border-bottom-width: 1px;
- border-bottom-style: solid;
- border-bottom-color: var(--pf-t--color--gray--80);
-}
-
-.karavan .nav-button-selected .pf-v6-c-button {
- background: rgba(236, 122, 8, 0.25);
- &:hover {
- /*background: color-mix(in srgb, var(--pf-t--color--blue--60) 50%, transparent);*/
- }
-
- .nav-button-badge {
- .pf-v6-c-badge {
- padding: 0 6px;
- min-width: fit-content;
- color: var(--pf-t--color--orange--40);
- background-color: var(--pf-t--color--gray--95);
- font-weight: 500;
- }
- }
-
- &::before {
- content: "";
- position: absolute;
- inset: 0;
- border-radius: inherit;
- border-left: 2px solid rgba(236, 122, 8, 1);
- pointer-events: none;
- }
-}
-
-.karavan .nav-buttons {
- .dark-mode-toggle {
- display: flex;
- flex-direction: row;
- justify-content: center;
- width: 100%;
- padding: 12px;
- border-top-width: 1px;
- border-top-style: solid;
- border-top-color: var(--pf-t--color--gray--80);
- border-radius: 0;
- }
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/app/navigation/PageNavigation.tsx b/karavan-app/src/main/webui/src/karavan/app/navigation/PageNavigation.tsx
deleted file mode 100644
index ca61442f..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/navigation/PageNavigation.tsx
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useContext, useState} from 'react';
-import {Badge, Button,} from '@patternfly/react-core';
-import './PageNavigation.css';
-import {useAppConfigStore, useDevModeStore, useFileStore} from "@stores/ProjectStore";
-import {shallow} from "zustand/shallow";
-import {useLocation, useNavigate} from "react-router-dom";
-import {SsoApi} from "@api/auth/SsoApi";
-import {UserPopupOidc} from "../login/UserPopupOidc";
-import {BUILD_IN_PROJECTS} from "@models/ProjectModels";
-import DarkModeToggle from "@app/theme/DarkModeToggle";
-import {AuthApi} from "@api/auth/AuthApi";
-import {getNavigationFirstMenu, getNavigationSecondMenu, MenuItem} from "@app/navigation/NavigationMenu";
-import {AuthContext} from "@api/auth/AuthProvider";
-import {PlatformLogoBase64} from "@app/navigation/PlatformLogo";
-import {PlatformVersions} from "@shared/ui/PlatformLogos";
-
-function PageNavigation() {
-
- const [config] = useAppConfigStore((s) => [s.config], shallow)
- const firstMenu = getNavigationFirstMenu();
- const secondMenu = getNavigationSecondMenu(config.environment, config.infrastructure);
- const [setFile] = useFileStore((state) => [state.setFile], shallow)
- const [setStatus, setPodName] = useDevModeStore((state) => [state.setStatus, state.setPodName], shallow)
- const [pageId, setPageId] = useState<string>();
- const navigate = useNavigate();
- const location = useLocation();
- const {reload} = useContext(AuthContext);
-
- React.useEffect(() => {
- var page = location.pathname?.split("/").filter(Boolean)[0];
- if (page === 'projects') {
- var projectId = location.pathname?.split("/").filter(Boolean)[1];
- if (BUILD_IN_PROJECTS.includes(projectId)) {
- setPageId('settings');
- } else {
- setPageId(page);
- }
- } else if (page !== undefined) {
- setPageId(page);
- } else if (config.environment === 'dev') {
- setPageId('projects');
- } else {
- setPageId('projects');
- }
- }, [location]);
-
- function onClick(page: MenuItem) {
- if (page.pageId === 'logout') {
- if (AuthApi.authType === 'oidc') {
- SsoApi.logout(() => {
- });
- } else if (AuthApi.authType === 'session') {
- AuthApi.logout();
- reload();
- }
- } else {
- setFile('none', undefined);
- setPodName(undefined);
- setStatus("none");
- setPageId(page.pageId);
- navigate(page.pageId);
- }
- }
-
- function getMenu(menu: MenuItem[]) {
- return (
- menu.map((page, index) => {
- let className = "nav-button";
- const isSelected = pageId === page.pageId;
- className = className.concat(isSelected ? " nav-button-selected" : "");
- return (
- <div key={page.pageId} className={isSelected ? "nav-button-selected nav-button-wrapper" : "nav-button-wrapper"}>
- <Button id={page.pageId}
- style={{width: '100%'}}
- variant={"link"}
- className={className}
- // countOptions={badge}
- onClick={_ => onClick(page)}
- >
- <div style={{display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '8px'}}>
- {page.icon}
- {page.name}
- </div>
- </Button>
- </div>
- )
- })
- )
- }
-
- return (
- <div className="nav-buttons pf-v6-theme-dark">
- <div className='nav-button-part-wrapper'>
- <img src={PlatformLogoBase64()} className="logo" alt='logo'/>
- <div style={{alignSelf: 'center'}} className='environment-wrapper'>
- <Badge isRead className='environment'>{config.environment}</Badge>
- </div>
- </div>
- {getMenu(firstMenu)}
- <div style={{flex: 2}}/>
- {getMenu(secondMenu)}
- {AuthApi.authType === 'oidc' &&
- <div className='nav-button-part-wrapper'>
- <UserPopupOidc/>
- </div>
- }
- <div className={"dark-mode-toggle"}>
- <DarkModeToggle/>
- </div>
- <PlatformVersions/>
- </div>
- )
-}
-
-export default PageNavigation
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/app/navigation/PlatformLogo.tsx b/karavan-app/src/main/webui/src/karavan/app/navigation/PlatformLogo.tsx
deleted file mode 100644
index d2cfe0e9..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/navigation/PlatformLogo.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import {KaravanIcon} from "@features/project/designer/icons/KaravanIcons";
-
-export function PlatformLogoBase64() {
-
- return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgICAgICB3aWR0aD0iMzYwLjEzODg1IgogICAgICAgIGhlaWdodD0iMzYwLjEzODg1IgogICAgICAgIHZpZXdCb3g9IjAgMCAzNjAuMTM4ODUgMzYwLjEzODg1IgogICAgICAgIHZlcnNpb249IjEuMSIKICAgICAgICBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCIKICAgICAgICBpZD0ic3ZnNTAiCiAgICAgICAgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiCiAgICAgICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogIC [...]
-}
-
-export function PlatformLogo(classNames?: string) {
- return KaravanIcon(classNames)
-}
-
-export default PlatformLogo;
diff --git a/karavan-app/src/main/webui/src/karavan/app/navigation/ProjectFunctionHook.tsx b/karavan-app/src/main/webui/src/karavan/app/navigation/ProjectFunctionHook.tsx
deleted file mode 100644
index f709efdb..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/navigation/ProjectFunctionHook.tsx
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {EventBus} from "@features/project/designer/utils/EventBus";
-import {ProjectFile} from "@models/ProjectModels";
-import {DslMetaModel} from "@features/project/designer/utils/DslMetaModel";
-import {v4 as uuidv4} from "uuid";
-import {CamelUi} from "@features/project/designer/utils/CamelUi";
-import {KaravanApi} from "@api/KaravanApi";
-import {Integration} from "@karavan-core/model/IntegrationDefinition";
-import {FILE_WORDS_SEPARATOR, KARAVAN_DOT_EXTENSION, KARAVAN_FILENAME, OPENAPI_FILE_NAME_JSON} from "@karavan-core/contants";
-import {RouteConfigurationDefinition} from "@karavan-core/model/CamelDefinition";
-import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
-import {CamelDefinitionYaml} from "@karavan-core/api/CamelDefinitionYaml";
-import {CamelDefinitionApi} from "@karavan-core/api/CamelDefinitionApi";
-import {useDesignerStore, useSelectorStore} from "@features/project/designer/DesignerStore";
-import {shallow} from "zustand/shallow";
-import {useAppConfigStore, useFilesStore, useFileStore, useProjectStore, useWizardStore} from "@stores/ProjectStore";
-import {toSpecialRouteId} from "@features/project/designer/utils/ValidatorUtils";
-import {ProjectService} from "@services/ProjectService";
-import {useTemplatesStore} from "@stores/SettingsStore";
-import {useContainerStatusesStore} from "@stores/ContainerStatusesStore";
-
-export function ProjectFunctionHook() {
-
- const [config] = useAppConfigStore((state) => [state.config], shallow)
- const [files] = useFilesStore((s) => [s.files], shallow);
- const [isRouteTemplate] = useSelectorStore((s) => [s.isRouteTemplate], shallow)
- const [setFile] = useFileStore((s) => [s.setFile], shallow);
- const [setShowWizard] = useWizardStore((s) => [s.setShowWizard], shallow)
- const [setDesignerSwitch] = useDesignerStore((s) => [s.setDesignerSwitch], shallow)
- const [project, tabIndex, setTabIndex, refreshTrace, fetchCamelStatuses] =
- useProjectStore((s) => [s.project, s.tabIndex, s.setTabIndex, s.refreshTrace, s.fetchCamelStatuses], shallow);
- const {fetchTemplateFiles} = useTemplatesStore();
- const { fetchContainers } = useContainerStatusesStore();
-
- function createRouteConfiguration() {
- const integration = Integration.createNew(KARAVAN_FILENAME.ROUTE_CONFIGURATION);
- const routeConfiguration = new RouteConfigurationDefinition();
- const i = CamelDefinitionApiExt.addRouteConfigurationToIntegration(integration, routeConfiguration);
- const yaml = CamelDefinitionYaml.integrationToYaml(i);
- const file = new ProjectFile(KARAVAN_FILENAME.ROUTE_CONFIGURATION, project.projectId, yaml, Date.now());
- saveNewFile(file, true, 'routes')
- }
-
- function generateParamUri(dsl: DslMetaModel) {
- const uuid = uuidv4().substring(0, 3)
- const uri = dsl.uri + FILE_WORDS_SEPARATOR +
- (dsl.properties && Object.keys(dsl.properties).length > 0
- ? Object.values(dsl.properties).join(FILE_WORDS_SEPARATOR)
- : uuid);
- return uri
- .replace(/[^a-zA-Z0-9]/g, '-')
- .replace(/-+/g, '-')
- .replace(/^-|-$/g, '');
- }
-
- function createNewRouteFile(dsl: DslMetaModel, parentId: string, position?: number | undefined, fileName?: string) {
- try {
- if (dsl.dsl === 'FromDefinition' && dsl.uri) {
- const paramsUri = generateParamUri(dsl);
- const fullUri = `From${FILE_WORDS_SEPARATOR}${paramsUri}`
-
- const name = toSpecialRouteId(`from${FILE_WORDS_SEPARATOR}${fullUri}`);
- const fName = (fileName != undefined ? fileName : name) + KARAVAN_DOT_EXTENSION.CAMEL_YAML;
- const route = CamelUi.createRouteFromComponent(dsl.uri, dsl.properties, '');
- const integration = Integration.createNew(fName);
- let i;
- if (isRouteTemplate) {
- const keys = dsl.properties ? Object.keys(dsl.properties) : [];
- const key = keys.at(0);
- const routeId = dsl.properties?.[key] + "Route";
- const templateId = dsl.properties?.[key] + "RouteTemplate";
- const route = CamelUi.createRouteFromComponent(dsl.uri, dsl.properties, '');
- route.id = routeId
- route.nodePrefixId = routeId
- const routeTemplate = CamelDefinitionApi.createRouteTemplateDefinition({id: templateId, route: route});
- i = CamelDefinitionApiExt.addRouteTemplateToIntegration(integration, routeTemplate);
- } else {
- i = CamelDefinitionApiExt.addStepToIntegration(integration, route, '');
- }
-
- const yaml = CamelDefinitionYaml.integrationToYaml(i);
- const file = new ProjectFile(fName, project.projectId, yaml, Date.now());
- saveNewFile(file, true, 'routes')
- }
- } catch (e: any) {
- console.error(e);
- EventBus.sendAlert("Error creating file", e.message, "danger");
- }
- }
-
- function createNewRestFile() {
- try {
- const fileExists = files.find(f => f.name === "rest-api.camel.yaml") !== undefined;
- const uuid = uuidv4().substring(0, 3)
- const fileName = 'rest-api' + (fileExists ? FILE_WORDS_SEPARATOR + uuid : '') + '.camel.yaml';
- const nodePrefixId = 'rest-' + uuid;
- const rest = CamelDefinitionApi.createRestDefinition({
- id: nodePrefixId,
- description: 'Service Example',
- path: 'example',
- consumes: 'application/json',
- produces: 'application/json',
- get: [CamelDefinitionApi.createGetDefinition({to: 'direct:getExample', description: 'GET Example'})],
- post: [CamelDefinitionApi.createPostDefinition({to: 'direct:postExample', description: 'POST Example'})],
- delete: [CamelDefinitionApi.createDeleteDefinition({to: 'direct:deleteExample', description: 'DELETE Example'})],
- });
- const restConfiguration = CamelDefinitionApi.createRestConfigurationDefinition({
- inlineRoutes: false,
- });
- const integration = Integration.createNew(fileName);
- let i = CamelDefinitionApiExt.addRestToIntegration(integration, rest);
- i = CamelDefinitionApiExt.addRestToIntegration(i, restConfiguration);
- const yaml = CamelDefinitionYaml.integrationToYaml(i);
- const file = new ProjectFile(fileName, project.projectId, yaml, Date.now());
- saveNewFile(file, true, 'rest')
- } catch (e: any) {
- EventBus.sendAlert("Error creating file", e.message, "danger");
- }
- }
-
- function createNewKamelet() {
- setFile('create', undefined, 'kamelet')
- }
-
- function createNewBean() {
- setShowWizard(true)
- }
-
- function createOpenApiRestFile() {
- try {
- const fileName = 'openapi-rest-config.camel.yaml';
- const rest = CamelDefinitionApi.createRestDefinition({
- id: 'openApiRestService',
- openApi: CamelDefinitionApi.createOpenApiDefinition({specification: 'classpath://' + OPENAPI_FILE_NAME_JSON})
- });
- const restConfiguration = CamelDefinitionApi.createRestConfigurationDefinition({
- inlineRoutes: false,
- });
- const integration = Integration.createNew(fileName);
- let i = CamelDefinitionApiExt.addRestToIntegration(integration, rest);
- i = CamelDefinitionApiExt.addRestToIntegration(i, restConfiguration);
- const yaml = CamelDefinitionYaml.integrationToYaml(i);
- const file = new ProjectFile(fileName, project.projectId, yaml, Date.now());
- saveNewFile(file, false)
- } catch (e: any) {
- EventBus.sendAlert("Error creating file", e.message, "danger");
- }
- }
-
- function createOpenApiJsonFile() {
-
- }
-
- function createAsyncApi() {
-
- }
-
- function createOpenApi() {
-
- }
-
- function saveNewFile(file: ProjectFile, openFile: boolean, designerTab?: "routes" | "rest" | "beans" | "kamelet") {
- KaravanApi.saveProjectFile(file, (result, fileRes) => {
- if (result) {
- EventBus.sendAlert("Success", `File ${file.name} successfully created`, "success");
- // ProjectService.refreshProjectData(project.projectId);
- if (file.code && openFile) {
- setFile('select', file, designerTab);
- setTabIndex(0);
- } else {
- setFile("none");
- }
- } else {
- EventBus.sendAlert("Error creating file", fileRes?.response?.data, "danger");
- }
- })
- }
-
- async function saveFiles(projectId: string, filesToSave: ProjectFile[], afterSuccess?: () => void) {
-
- // 1. Fetch all existing files for the project once
- KaravanApi.getFiles(projectId, async (existingFiles: ProjectFile[]) => {
- const existingNames = new Set(existingFiles.map(f => f.name));
-
- // 2. Map each file to a Promise (Update if exists, Create if not)
- const savePromises = filesToSave.map(file => {
- return new Promise<boolean>((resolve) => {
- const alreadyExists = existingNames.has(file.name);
-
- if (alreadyExists) {
- KaravanApi.putProjectFile(file, (result) => resolve(!!result));
- } else {
- KaravanApi.saveProjectFile(file, (result) => resolve(!!result));
- }
- });
- });
-
- try {
- // 3. Wait for all individual save/put operations to finish
- const results = await Promise.all(savePromises);
- const allSuccessful = results.every(res => res === true);
-
- // 4. Final actions after all operations complete
- if (allSuccessful) {
- afterSuccess?.();
- EventBus.sendAlert("Success", `All ${filesToSave.length} files processed`, "success");
- } else {
- const failCount = results.filter(r => !r).length;
- EventBus.sendAlert("Warning", `${failCount} files failed to save`, "danger");
- }
- } catch (error) {
- EventBus.sendAlert("Error", "A critical error occurred during the batch save", "danger");
- }
- });
- }
-
- function saveFile(file: ProjectFile, afterSuccess?: () => void) {
- KaravanApi.getProjectFilesByName(file.projectId, file.name, found => {
- if (found) {
- KaravanApi.putProjectFile(file, (result) => {
- if (result) {
- afterSuccess?.();
- EventBus.sendAlert("Success", `File ${file.name} successfully updated`, "success");
- } else {
- EventBus.sendAlert("Error updating file", file.name, "danger");
- }
- })
- } else {
- KaravanApi.saveProjectFile(file, (result, fileRes) => {
- if (result) {
- afterSuccess?.();
- EventBus.sendAlert("Success", `File ${file.name} successfully created`, "success");
- } else {
- EventBus.sendAlert("Error creating file", fileRes?.response?.data, "danger");
- }
- })
- }
- })
- }
-
- function refreshData() {
- fetchCamelStatuses(project.projectId, config.environment);
- fetchContainers();
- if (tabIndex === "build") {
- ProjectService.refreshAllDeploymentStatuses();
- ProjectService.refreshImages(project.projectId);
- } if (tabIndex === 'topology') {
- }
- }
-
- function refreshSharedData() {
- fetchTemplateFiles();
- }
-
- return {createNewRouteFile, createOpenApiRestFile, createNewBean, createNewKamelet, createRouteConfiguration, refreshSharedData,
- project, createNewRestFile, refreshData, createAsyncApi, createOpenApi}
-}
diff --git a/karavan-app/src/main/webui/src/karavan/app/navigation/ProtectedRoute.tsx b/karavan-app/src/main/webui/src/karavan/app/navigation/ProtectedRoute.tsx
deleted file mode 100644
index a397132d..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/navigation/ProtectedRoute.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import {Navigate, useLocation} from "react-router-dom";
-import {JSX, useContext} from "react";
-import {AuthContext} from "@api/auth/AuthProvider";
-import {ROUTES} from "@app/navigation/Routes";
-import {useReadinessStore} from "@stores/ReadinessStore";
-
-export function ProtectedRoute({ children }: { children: JSX.Element }) {
- const { readiness } = useReadinessStore();
- const { user, loading } = useContext(AuthContext);
- const location = useLocation();
-
- if (readiness === undefined || readiness.status !== true) {
- return children; // stay on loader page if already there
- }
-
- if (!user && location.pathname !== ROUTES.LOGIN) {
- return <Navigate to={ROUTES.LOGIN} state={{ from: location }} replace />;
- }
-
- if (user && location.pathname === ROUTES.LOGIN) {
- return <Navigate to={ROUTES.ROOT} state={{ from: location }} />;
- }
-
- return children;
-}
diff --git a/karavan-app/src/main/webui/src/karavan/app/navigation/Routes.ts b/karavan-app/src/main/webui/src/karavan/app/navigation/Routes.ts
deleted file mode 100644
index c9daa3e8..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/navigation/Routes.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export const ROUTES = {
- PROJECTS: "/projects",
- PROJECT_DETAIL: "/projects/:projectId",
- PROJECT_FILE: "/projects/:projectId/:fileName",
- SYSTEM: "/system",
- SETTINGS: "/settings",
- SETTINGS_FILE: "/settings/:projectId/:fileName",
- DOCUMENTATION: "/documentation",
- FORBIDDEN: "/403",
- ACL: "/acl",
- LOGIN: "/login",
- // fallback redirect
- ROOT: "/",
-};
diff --git a/karavan-app/src/main/webui/src/karavan/app/theme/DarkModeToggle.tsx b/karavan-app/src/main/webui/src/karavan/app/theme/DarkModeToggle.tsx
deleted file mode 100644
index 1a50f6c6..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/theme/DarkModeToggle.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { ToggleGroup, ToggleGroupItem } from '@patternfly/react-core';
-import { SunIcon, MoonIcon } from '@patternfly/react-icons';
-import { useTheme } from './ThemeContext';
-
-const DarkModeToggle = () => {
- const { isDark, toggleDarkMode } = useTheme();
-
- return (
- <ToggleGroup aria-label="DarkModeToggle" isCompact>
- <ToggleGroupItem
- icon={<SunIcon />}
- aria-label="light"
- buttonId="toggle-group-icons-1"
- isSelected={!isDark}
- onChange={(event, selected) => toggleDarkMode(!selected)}
- />
- <ToggleGroupItem
- icon={<MoonIcon />}
- aria-label="dark"
- buttonId="toggle-group-icons-2"
- isSelected={isDark}
- onChange={(event, selected) => toggleDarkMode(selected)}
- />
- </ToggleGroup>
- );
-};
-
-export default DarkModeToggle;
diff --git a/karavan-app/src/main/webui/src/karavan/app/theme/ThemeContext.tsx b/karavan-app/src/main/webui/src/karavan/app/theme/ThemeContext.tsx
deleted file mode 100644
index 90fb6251..00000000
--- a/karavan-app/src/main/webui/src/karavan/app/theme/ThemeContext.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {createContext, useContext, useEffect, useState} from 'react';
-
-interface ThemeContextType {
- isDark: boolean;
- toggleDarkMode: (checked: boolean) => void;
-}
-
-const ThemeContext = createContext<ThemeContextType | undefined>(undefined);
-
-export const ThemeProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
- const [isDark, setIsDark] = useState(false);
-
- useEffect(() => {
- const storedTheme = localStorage.getItem('pf-theme');
-
- let shouldUseDark = false;
-
- if (storedTheme === 'dark') {
- shouldUseDark = true;
- } else if (storedTheme === 'light') {
- shouldUseDark = false;
- } else {
- // No stored preference → use browser preference
- shouldUseDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
- }
-
- setIsDark(shouldUseDark);
- document.documentElement.classList.toggle('pf-v6-theme-dark', shouldUseDark);
- }, []);
-
- const toggleDarkMode = (checked: boolean) => {
- setIsDark(checked);
- document.documentElement.classList.toggle('pf-v6-theme-dark', checked);
- localStorage.setItem('pf-theme', checked ? 'dark' : 'light');
- };
-
- return (
- <ThemeContext.Provider value={{ isDark, toggleDarkMode }}>
- {children}
- </ThemeContext.Provider>
- );
-};
-
-export const useTheme = (): ThemeContextType => {
- const context = useContext(ThemeContext);
- if (!context) {
- throw new Error('useTheme must be used within a ThemeProvider');
- }
- return context;
-};
diff --git a/karavan-app/src/main/webui/src/karavan/bus/ErrorEventBus.ts b/karavan-app/src/main/webui/src/karavan/bus/ErrorEventBus.ts
deleted file mode 100644
index 17df7fb2..00000000
--- a/karavan-app/src/main/webui/src/karavan/bus/ErrorEventBus.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import {Subject} from 'rxjs';
-
-const apiErrors = new Subject<any>();
-
-export const ErrorEventBus = {
-
- sendApiError: (error: any) => apiErrors.next(error),
- onApiError: () => apiErrors.asObservable(),
-}
diff --git a/karavan-app/src/main/webui/src/karavan/bus/ProjectEventBus.ts b/karavan-app/src/main/webui/src/karavan/bus/ProjectEventBus.ts
deleted file mode 100644
index 84e458e7..00000000
--- a/karavan-app/src/main/webui/src/karavan/bus/ProjectEventBus.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import {Subject} from 'rxjs';
-
-const log = new Subject<["add" | "set", string]>();
-
-export const ProjectEventBus = {
-
- sendLog: (type: "add" | "set", m: string) => log.next([type, m]),
- onLog: () => log.asObservable(),
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/access/AccessPage.tsx b/karavan-app/src/main/webui/src/karavan/features/access/AccessPage.tsx
deleted file mode 100644
index 2ad6abb3..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/access/AccessPage.tsx
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect, useState} from 'react';
-import {Button, capitalize, Content, Nav, NavItem, NavList, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities,} from '@patternfly/react-core';
-import {useAccessStore} from "@stores/AccessStore";
-import {shallow} from "zustand/shallow";
-import {AccessService} from "@services/AccessService";
-import PlusIcon from "@patternfly/react-icons/dist/esm/icons/plus-icon";
-import RefreshIcon from "@patternfly/react-icons/dist/esm/icons/sync-alt-icon";
-import {RightPanel} from "@shared/ui/RightPanel";
-import SearchIcon from "@patternfly/react-icons/dist/esm/icons/search-icon";
-import TimesIcon from "@patternfly/react-icons/dist/esm/icons/times-icon";
-import {UsersTable} from "@features/access/users/UsersTable";
-import {ErrorBoundaryWrapper} from "@features/project/designer/ErrorBoundaryWrapper";
-import {RolesTable} from "@features/access/roles/RolesTable";
-import {UserModal} from "./users/UserModal";
-import {RoleModal} from "@features/access/roles/RoleModal";
-import {UserProfileTab} from "@features/access/users/UserProfileTab";
-import {getCurrentUser} from "@api/auth/AuthApi";
-import {PLATFORM_ADMIN} from "@models/AccessModels";
-import {PasswordModal} from "@features/access/users/PasswordModal";
-
-export const AccessPage = () => {
-
- const adminMenus: (string | number)[] = ['profile', 'users', 'roles'];
- const userMenus: (string | number)[] = ['profile'];
- const [showUserModal, setShowUserModal, setFilter, filter, setCurrentUser, showRoleModal, setShowRoleModal, showPasswordModal] =
- useAccessStore((s) => [s.showUserModal, s.setShowUserModal, s.setFilter, s.filter, s.setCurrentUser, s.showRoleModal, s.setShowRoleModal, s.showPasswordModal], shallow);
- const [activeItem, setActiveItem] = useState<string | number>(userMenus.at(0)!);
- const onSelect = (_event: React.FormEvent<HTMLInputElement>, result: { itemId: number | string }) => {
- setActiveItem(result.itemId);
- };
-
- useEffect(() => AccessService.refreshAccess(), []);
-
- function searchInput() {
- return (
- <TextInputGroup className="search" style={{width:'300px'}}>
- <TextInputGroupMain
- value={filter}
- placeholder='Search'
- type="text"
- autoComplete={"off"}
- autoFocus={true}
- icon={<SearchIcon/>}
- onChange={(_event, value) => {
- setFilter(value);
- }}
- aria-label="text input example"
- />
- <TextInputGroupUtilities>
- <Button variant="plain" onClick={_ => {
- setFilter('');
- }}>
- <TimesIcon aria-hidden={true}/>
- </Button>
- </TextInputGroupUtilities>
- </TextInputGroup>
- )
- }
-
- function tools() {
- return (<div className="project-files-toolbar" style={{justifyContent: "flex-end"}}>
- <Button icon={<RefreshIcon/>}
- variant={"link"}
- onClick={e => AccessService.refreshAccess()}
- />
- {searchInput()}
- <Button className="dev-action-button"
- icon={<PlusIcon/>}
- onClick={e => {
- setCurrentUser(undefined)
- if (activeItem === "users") {
- setShowUserModal(true)
- } else {
- setShowRoleModal(true)
- }
- }}
- >Add</Button>
- </div>);
- }
-
- function title() {
- return (
- <Content component="h2">Access Control</Content>
- );
- }
-
- function getNavigation() {
- return (
- <Nav onSelect={onSelect} aria-label="Nav" variant="horizontal">
- <NavList>
- {(getCurrentUser()?.roles?.includes(PLATFORM_ADMIN) ? adminMenus : userMenus)
- .filter(m => []).map((item, i) =>
- <NavItem key={item} preventDefault itemId={item} isActive={activeItem === item} to="#">
- {capitalize(item?.toString())}
- </NavItem>
- )}
- </NavList>
- </Nav>
- )
- }
-
- return (
- <RightPanel
- title={title()}
- toolsStart={getNavigation()}
- tools={undefined}
- mainPanel={
- <div className="right-panel-card">
- <ErrorBoundaryWrapper key='info' onError={error => console.error(error)}>
- <div style={{display: 'flex', flexDirection: 'column', height: '100%'}}>
- {activeItem !== 'profile' && tools()}
- {activeItem === 'users' && <UsersTable/>}
- {activeItem === 'roles' && <RolesTable/>}
- {activeItem === 'profile' && <UserProfileTab/>}
- {showUserModal && <UserModal/>}
- {showRoleModal && <RoleModal/>}
- {showPasswordModal && <PasswordModal/>}
- </div>
- </ErrorBoundaryWrapper>
- </div>
- }
- />
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/access/roles/RoleModal.tsx b/karavan-app/src/main/webui/src/karavan/features/access/roles/RoleModal.tsx
deleted file mode 100644
index cc7987ff..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/access/roles/RoleModal.tsx
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect} from 'react';
-import {Alert, Button, Content, Form, FormAlert, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant,} from '@patternfly/react-core';
-import {SubmitHandler, useForm} from "react-hook-form";
-import {AxiosResponse} from "axios";
-import {AccessRole} from "../../../models/AccessModels";
-import {useAccessStore} from "../../../stores/AccessStore";
-import {useFormUtil} from "@util/useFormUtil";
-import {EventBus} from "@features/project/designer/utils/EventBus";
-import {shallow} from "zustand/shallow";
-import {AccessApi} from "../../../api/AccessApi";
-import {AccessService} from "@services/AccessService";
-
-
-export function RoleModal() {
-
- const [showRoleModal, setShowRoleModal, roles]= useAccessStore((s) => [s.showRoleModal, s.setShowRoleModal, s.roles], shallow);
- const [isReset, setReset] = React.useState(false);
- const [backendError, setBackendError] = React.useState<string>();
- const formContext = useForm<AccessRole>({mode: "all"});
- const {getTextField} = useFormUtil(formContext);
- const {
- formState: {errors},
- handleSubmit,
- reset,
- trigger
- } = formContext;
-
- useEffect(() => {
- reset(new AccessRole());
- setBackendError(undefined);
- setReset(true);
- }, [reset]);
-
- useEffect(() => {
- isReset && trigger();
- }, [trigger, isReset]);
-
- function closeModal() {
- setShowRoleModal(false)
- }
-
- const onSubmit: SubmitHandler<AccessRole> = (data) => {
- AccessApi.postRole(data, after)
- }
-
- function after(result: boolean, res: AxiosResponse<AccessRole> | any) {
- if (result) {
- onSuccess(res.data);
- } else {
- const data = res?.response?.data;
- const error = data && data !== '' ? data : res?.message;
- setBackendError(error);
- }
- }
-
- function onSuccess(role: AccessRole) {
- const message = `Role ${role.name} successfully created`;
- EventBus.sendAlert("Success", message, "success");
- closeModal();
- AccessService.refreshAccess();
- }
-
- function onKeyDown(event: React.KeyboardEvent<HTMLDivElement>): void {
- if (event.key === 'Enter') {
- handleSubmit(onSubmit)()
- }
- }
-
- function isValidName(input: string): boolean {
- return !roles.map(r => r.name).includes(input);
- }
-
- function canNotSubmit() {
- return Object.getOwnPropertyNames(errors).length > 0;
- }
-
- return (
- <Modal
- variant={ModalVariant.small}
- isOpen={showRoleModal}
- onClose={closeModal}
- onKeyDown={onKeyDown}
- >
- <ModalHeader>
- <Content component='h2'>Add role</Content>
- </ModalHeader>
- <ModalBody>
- <Form isHorizontal={true} autoComplete="off">
- {getTextField('name', 'Name', {
- length: v => v.length > 0 || 'Name should not be empty',
- name: v => isValidName(v) || "Role already exists!s",
- })}
- {getTextField('description', 'Description', {
- length: v => v.length > 0 || 'Description should not be empty',
- })}
- {backendError &&
- <FormAlert>
- <Alert variant="danger" title={backendError} aria-live="polite" isInline/>
- </FormAlert>
- }
- </Form>
- </ModalBody>
- <ModalFooter>
- <Button key="confirm" variant="primary"
- onClick={handleSubmit(onSubmit)}
- isDisabled={canNotSubmit()}
- >
- Save
- </Button>
- <Button key="cancel" variant="secondary" onClick={closeModal}>Cancel</Button>
- </ModalFooter>
- </Modal>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/access/roles/RolesTable.tsx b/karavan-app/src/main/webui/src/karavan/features/access/roles/RolesTable.tsx
deleted file mode 100644
index 360c44dd..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/access/roles/RolesTable.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useState} from 'react';
-import {Bullseye, EmptyState, EmptyStateVariant, Spinner} from '@patternfly/react-core';
-import {InnerScrollContainer, OuterScrollContainer, Table, TableVariant, Tbody, Td, Th, Thead, Tr} from '@patternfly/react-table';
-import SearchIcon from "@patternfly/react-icons/dist/esm/icons/search-icon";
-import {shallow} from "zustand/shallow";
-import {useAccessStore} from "@stores/AccessStore";
-import {AccessRole} from "@models/AccessModels";
-import {RolesTableRow} from "@features/access/roles/RolesTableRow";
-
-export function RolesTable() {
-
- const [roles, filter] = useAccessStore((s) => [s.roles, s.filter], shallow);
- const [loading] = useState<boolean>(true);
-
- function getEmptyState() {
- return (
- <Tbody>
- <Tr>
- <Td colSpan={8}>
- <Bullseye>
- {loading && <Spinner className="progress-stepper" diameter="80px" aria-label="Loading..."/>}
- {!loading &&
- <EmptyState variant={EmptyStateVariant.sm} titleText="No results found" icon={SearchIcon} headingLevel="h2"/>
- }
- </Bullseye>
- </Td>
- </Tr>
- </Tbody>
- )
- }
-
- const conts = roles.filter(role =>
- role.name?.toLowerCase().includes(filter)
- || role.name?.toLowerCase().includes(filter)
- || role.name?.toLowerCase().includes(filter)
- ).sort((a, b) => a.name.localeCompare(b.name));
- return (
- <OuterScrollContainer>
- <InnerScrollContainer>
- <Table aria-label="Projects" variant={TableVariant.compact} isStickyHeader>
- <Thead>
- <Tr>
- <Th key='type' modifier={'fitContent'}>Type</Th>
- <Th key='name'>Name</Th>
- <Th key='decription'>Description</Th>
- <Th key='users'>Users</Th>
- <Th key='action' screenReaderText='pass'></Th>
- </Tr>
- </Thead>
- {conts?.map((role: AccessRole, index: number) => (
- <RolesTableRow key={role.name} index={index} role={role}/>
- ))}
- {conts?.length === 0 && getEmptyState()}
- </Table>
- </InnerScrollContainer>
- </OuterScrollContainer>
- )
-
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/access/roles/RolesTableRow.tsx b/karavan-app/src/main/webui/src/karavan/features/access/roles/RolesTableRow.tsx
deleted file mode 100644
index c26653ac..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/access/roles/RolesTableRow.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useState} from 'react';
-import {Button, capitalize, Content, Label} from '@patternfly/react-core';
-import {Tbody, Td, Tr} from "@patternfly/react-table";
-import {AccessRole, PLATFORM_ADMIN, PLATFORM_DEVELOPER, PLATFORM_USER} from "../../../models/AccessModels";
-import {useAccessStore} from "../../../stores/AccessStore";
-import {shallow} from "zustand/shallow";
-import DeleteIcon from "@patternfly/react-icons/dist/js/icons/times-icon";
-import {ShieldAltIcon, UsersIcon} from "@patternfly/react-icons";
-import {ModalConfirmation} from "@shared/ui/ModalConfirmation";
-import {AccessApi} from "@api/AccessApi";
-import {AccessService} from "@services/AccessService";
-
-interface Props {
- index: number
- role: AccessRole
-}
-
-export function RolesTableRow(props: Props) {
-
- const [users] = useAccessStore((s) => [s.users], shallow);
- const [showConfirmation, setShowConfirmation] = useState<boolean>(false);
- const [command, setCommand] = useState<'create' | 'delete' >();
-
- const {role} = props;
-
- function executeAction() {
- if (command === 'delete') {
- AccessApi.deleteRole(role.name, result => {
- AccessService.refreshAccess();
- });
- }
- setShowConfirmation(false);
- }
-
- function getConfirmationText() {
- if (command === 'delete') {
- return (
- <div style={{ display: 'flex', flexDirection: 'row', gap: '4px', alignItems: 'center' }}>
- <Label color='red'>{capitalize('' + command)}</Label>
- {" role "}
- {<Label color='blue'>{role.name}</Label>}
- {" ?"}
- </div>
- )
- }
- }
-
- const usersWithRole = users.filter(user => user.roles?.includes(role.name))
- const isBuildInRole = [PLATFORM_DEVELOPER, PLATFORM_USER, PLATFORM_ADMIN].includes(role?.name);
- const canBeDeleted = !isBuildInRole && usersWithRole.length === 0;
- return (
- <Tbody>
- <Tr key={role.name} style={{verticalAlign: 'middle'}}>
- <Td>{isBuildInRole ? <ShieldAltIcon/> : <UsersIcon/>}</Td>
- <Td>{role.name}</Td>
- <Td>{role.description}</Td>
- <Td modifier='fitContent'>
- <div style={{display: 'flex', flexDirection: 'column', gap: '4px'}}>
- {usersWithRole.map(user => {
- return (
- <Content key={user.username}>{user.username}</Content>
- )
- })}
- </div>
- </Td>
-
- <Td isActionCell>
- <Button className="dev-action-button"
- isDisabled={!canBeDeleted}
- variant={"plain"}
- icon={<DeleteIcon/>}
- style={{padding: '6px', marginLeft: '6px'}}
- onClick={() => {
- setCommand('delete')
- setShowConfirmation(true);
- }}/>
- </Td>
- </Tr>
- {showConfirmation &&
- <ModalConfirmation
- isOpen={showConfirmation}
- message={getConfirmationText()}
- btnConfirm='Confirm'
- btnConfirmVariant='danger'
- onConfirm={() => {
- setCommand(undefined);
- setShowConfirmation(false);
- executeAction();
- }}
- onCancel={() => setShowConfirmation(false)}
- />
- }
- </Tbody>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/access/users/ChangePassword.tsx b/karavan-app/src/main/webui/src/karavan/features/access/users/ChangePassword.tsx
deleted file mode 100644
index dc0fc670..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/access/users/ChangePassword.tsx
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect} from 'react';
-import {Alert, Button, Card, CardBody, CardFooter, CardHeader, Content, Form, FormAlert, FormGroup, FormHelperText, HelperText, HelperTextItem,} from '@patternfly/react-core';
-import {SubmitHandler, useForm} from "react-hook-form";
-import {AxiosResponse} from "axios";
-import {AccessPassword} from "../../../models/AccessModels";
-import {useFormUtil} from "@util/useFormUtil";
-import {EventBus} from "@features/project/designer/utils/EventBus";
-import {AuthApi} from "@api/auth/AuthApi";
-
-
-export function ChangePassword() {
-
- const [isReset, setReset] = React.useState(false);
- const [backendError, setBackendError] = React.useState<string>();
- const formContext = useForm<AccessPassword>({mode: "all"});
- const {getPasswordField} = useFormUtil(formContext);
- const {
- formState: {errors},
- handleSubmit,
- reset,
- trigger
- } = formContext;
-
- useEffect(() => {
- reset(new AccessPassword());
- setBackendError(undefined);
- setReset(true);
- }, [reset]);
-
- useEffect(() => {
- isReset && trigger();
- }, [trigger, isReset]);
-
- const onSubmit: SubmitHandler<AccessPassword> = (data) => {
- AuthApi.setPassword(data, after)
- }
-
- function after(result: boolean, res: AxiosResponse<AccessPassword> | any) {
- if (result) {
- onSuccess();
- } else {
- const data = res?.response?.data;
- const error = data && data !== '' ? data : res?.message;
- setBackendError(error);
- }
- }
-
- function onSuccess() {
- const message = `Password successfully updated`;
- EventBus.sendAlert("Success", message, "success");
- }
-
- function arePasswordsEqual() {
- const pwd1 = formContext.getValues('password');
- const pwd2 = formContext.getValues('password2');
- return pwd1 === pwd2;
- }
-
- function canNotSubmit() {
- return Object.getOwnPropertyNames(errors).length > 0 || !arePasswordsEqual();
- }
-
- function getPasswordError() {
- if (!arePasswordsEqual()) {
- return (<FormGroup>
- <FormHelperText>
- <HelperText>
- <HelperTextItem variant={'error'}>
- Passwords should be equal!
- </HelperTextItem>
- </HelperText>
- </FormHelperText>
- </FormGroup>)
- }
- }
-
- return (
- <Card>
- <CardHeader>
- <Content component='h2'>Change password</Content>
- </CardHeader>
- <CardBody>
- <Form isHorizontal={true} autoComplete="off">
- {getPasswordField('currentPassword', 'Current Password', {})}
- {getPasswordField('password', 'Password', {})}
- {getPasswordField('password2', 'Retype Password', {})}
- {getPasswordError()}
- {backendError &&
- <FormAlert>
- <Alert variant="danger" title={backendError} aria-live="polite" isInline/>
- </FormAlert>
- }
- </Form>
- </CardBody>
- <CardFooter style={{display: 'flex', justifyContent: 'flex-end'}}>
- <Button key="confirm" variant="primary"
- onClick={handleSubmit(onSubmit)}
- isDisabled={canNotSubmit()}
- >
- Save
- </Button>
- </CardFooter>
- </Card>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/access/users/PasswordModal.tsx b/karavan-app/src/main/webui/src/karavan/features/access/users/PasswordModal.tsx
deleted file mode 100644
index 8a4959b5..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/access/users/PasswordModal.tsx
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect} from 'react';
-import {
- Alert,
- Button,
- Content,
- Form,
- FormAlert,
- FormGroup,
- FormHelperText,
- HelperText,
- HelperTextItem,
- Modal,
- ModalBody,
- ModalFooter,
- ModalHeader,
- ModalVariant,
-} from '@patternfly/react-core';
-import {SubmitHandler, useForm} from "react-hook-form";
-import {AxiosResponse} from "axios";
-import {useAccessStore} from "../../../stores/AccessStore";
-import {useFormUtil} from "@util/useFormUtil";
-import {EventBus} from "@features/project/designer/utils/EventBus";
-import {shallow} from "zustand/shallow";
-import {AccessPassword} from "@models/AccessModels";
-import {AccessApi} from "@api/AccessApi";
-
-
-export function PasswordModal() {
-
- const [showPasswordModal, setShowPasswordModal, currentUser]
- = useAccessStore((s) => [s.showPasswordModal, s.setShowPasswordModal, s.currentUser], shallow);
- const [isReset, setReset] = React.useState(false);
- const [backendError, setBackendError] = React.useState<string>();
- const formContext = useForm<AccessPassword>({mode: "all"});
- const {getPasswordField} = useFormUtil(formContext);
- const {
- formState: {errors},
- handleSubmit,
- reset,
- trigger
- } = formContext;
-
- useEffect(() => {
- reset(new AccessPassword());
- setBackendError(undefined);
- setReset(true);
- }, [reset]);
-
- useEffect(() => {
- isReset && trigger();
- }, [trigger, isReset]);
-
- const onSubmit: SubmitHandler<AccessPassword> = (data) => {
- if (currentUser?.username)
- AccessApi.setPassword(currentUser.username, data, after)
- }
-
- function after(result: boolean, res: AxiosResponse<AccessPassword> | any) {
- if (result) {
- onSuccess();
- } else {
- const data = res?.response?.data;
- const error = data && data !== '' ? data : res?.message;
- setBackendError(error);
- }
- }
-
- function onSuccess() {
- const message = `Password successfully updated`;
- EventBus.sendAlert("Success", message, "success");
- closeModal()
- }
-
- function arePasswordsEqual() {
- const pwd1 = formContext.getValues('password');
- const pwd2 = formContext.getValues('password2');
- return pwd1 === pwd2;
- }
-
- function canNotSubmit() {
- return Object.getOwnPropertyNames(errors).length > 0 || !arePasswordsEqual();
- }
-
- function getPasswordError() {
- if (!arePasswordsEqual()) {
- return (<FormGroup>
- <FormHelperText>
- <HelperText>
- <HelperTextItem variant={'error'}>
- Passwords should be equal!
- </HelperTextItem>
- </HelperText>
- </FormHelperText>
- </FormGroup>)
- }
- }
-
- function closeModal() {
- setShowPasswordModal(false)
- }
-
- function onKeyDown(event: React.KeyboardEvent<HTMLDivElement>): void {
- if (event.key === 'Enter') {
- handleSubmit(onSubmit)()
- }
- }
-
- return (
- <Modal
- variant={ModalVariant.small}
- isOpen={showPasswordModal}
- onClose={closeModal}
- onKeyDown={onKeyDown}
- >
- <ModalHeader>
- <Content component='h2'>{`Change password for user: ${currentUser?.username}`}</Content>
- </ModalHeader>
- <ModalBody>
- <Form isHorizontal={true} autoComplete="off">
- {getPasswordField('currentPassword', 'Your Password', {})}
- {getPasswordField('password', 'User Password', {})}
- {getPasswordField('password2', 'Retype Password', {})}
- {getPasswordError()}
- {backendError &&
- <FormAlert>
- <Alert variant="danger" title={backendError} aria-live="polite" isInline/>
- </FormAlert>
- }
- </Form>
- </ModalBody>
- <ModalFooter>
- <Button key="confirm" variant="primary"
- onClick={handleSubmit(onSubmit)}
- isDisabled={canNotSubmit()}
- >
- Save
- </Button>
- <Button key="cancel" variant="secondary" onClick={closeModal}>Cancel</Button>
- </ModalFooter>
- </Modal>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/access/users/UserModal.tsx b/karavan-app/src/main/webui/src/karavan/features/access/users/UserModal.tsx
deleted file mode 100644
index 5744f633..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/access/users/UserModal.tsx
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect} from 'react';
-import {Alert, Button, Content, Form, FormAlert, FormGroup, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, TextInput,} from '@patternfly/react-core';
-import {SubmitHandler, useForm} from "react-hook-form";
-import {AxiosResponse} from "axios";
-import {useAccessStore} from "../../../stores/AccessStore";
-import {useFormUtil} from "@util/useFormUtil";
-import {EventBus} from "@features/project/designer/utils/EventBus";
-import {shallow} from "zustand/shallow";
-import {AccessApi} from "../../../api/AccessApi";
-import {getCurrentUser} from "@api/auth/AuthApi";
-import {AccessService} from "@services/AccessService";
-import {AccessUser} from "@models/AccessModels";
-
-
-export function UserModal() {
-
- const [showUserModal, setShowUserModal, currentUser, users, roles]
- = useAccessStore((s) => [s.showUserModal, s.setShowUserModal, s.currentUser, s.users, s.roles], shallow);
- const [isReset, setReset] = React.useState(false);
- const [backendError, setBackendError] = React.useState<string>();
- const formContext = useForm<AccessUser>({mode: "all"});
- const {getTextField} = useFormUtil(formContext);
- const {
- formState: {errors},
- handleSubmit,
- reset,
- trigger
- } = formContext;
-
- useEffect(() => {
- if (isNewUser()) {
- reset(new AccessUser());
- } else {
- reset(currentUser);
- }
- setBackendError(undefined);
- setReset(true);
- }, [reset]);
-
- useEffect(() => {
- isReset && trigger();
- }, [trigger, isReset]);
-
- function closeModal() {
- setShowUserModal(false)
- }
-
- const onSubmit: SubmitHandler<AccessUser> = (data) => {
- if (isNewUser()) {
- AccessApi.postUser(data, after)
- } else {
- AccessApi.putUser(data, after)
- }
- }
-
- function after(result: boolean, res: AxiosResponse<AccessUser> | any) {
- if (result) {
- onSuccess(res.data);
- } else {
- const data = res?.response?.data;
- const error = data && data !== '' ? data : res?.message;
- setBackendError(error);
- }
- }
-
- function onSuccess(user: AccessUser) {
- const message = `User ${user.username} successfully ` + (isNewUser() ? "created" : "updated");
- EventBus.sendAlert("Success", message, "success");
- closeModal();
- if (isNewUser()) {
- AccessService.refreshAccess();
- } else {
- if (getCurrentUser()?.username !== user.username) {
- AccessService.refreshAccess();
- }
- }
- }
-
- function onKeyDown(event: React.KeyboardEvent<HTMLDivElement>): void {
- if (event.key === 'Enter') {
- handleSubmit(onSubmit)()
- }
- }
-
- function isValidUsername(input: string): boolean {
- const pattern = /^[a-z][a-z0-9-]*$/;
- return pattern.test(input);
- }
-
- function isValidEmail(input: string): boolean {
- const pattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
- return pattern.test(input);
- }
-
-
- function canNotSubmit() {
- return Object.getOwnPropertyNames(errors).length > 0;
- }
-
- function isNewUser() {
- return currentUser === undefined;
- }
-
- function itsMe() {
- return currentUser?.username === getCurrentUser()?.username;
- }
-
- return (
- <Modal
- variant={ModalVariant.small}
- isOpen={showUserModal}
- onClose={closeModal}
- onKeyDown={onKeyDown}
- >
- <ModalHeader>
- <Content component='h2'>{isNewUser() ? "Add user" : "Update user"}</Content>
- </ModalHeader>
- <ModalBody>
- <Form isHorizontal={true} autoComplete="off">
- {!isNewUser() &&
- <FormGroup label="Username" fieldId='username' isRequired>
- <TextInput className="text-field" type="text" id='username' value={currentUser?.username} isDisabled/>
- </FormGroup>
- }
- {isNewUser() && getTextField('username', 'Username', {
- regex: v => isValidUsername(v) || 'Only lowercase characters, numbers and dashes allowed',
- length: v => v.length > 2 || 'Username should be longer that 2 characters',
- name: v => !isNewUser() || !users.map(u => u.username).includes(v) || "User already exists!s",
- })}
- {getTextField('firstName', 'First Name', {
- length: v => v.length > 0 || 'First name should not be empty',
- })}
- {getTextField('lastName', 'Last Name', {
- length: v => v.length > 0 || 'Last name should not be empty',
- })}
- {getTextField('email', 'Email', {
- length: v => v.length > 0 || 'Last name should not be empty',
- email: v => isValidEmail(v) || 'Invalid email'
- }, 'email')}
- {backendError &&
- <FormAlert>
- <Alert variant="danger" title={backendError} aria-live="polite" isInline/>
- </FormAlert>
- }
- </Form>
- </ModalBody>
- <ModalFooter>
- <Button key="confirm" variant="primary"
- onClick={handleSubmit(onSubmit)}
- isDisabled={canNotSubmit()}
- >
- Save
- </Button>
- <Button key="cancel" variant="secondary" onClick={closeModal}>Cancel</Button>
- </ModalFooter>
- </Modal>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/access/users/UserProfile.tsx b/karavan-app/src/main/webui/src/karavan/features/access/users/UserProfile.tsx
deleted file mode 100644
index 1f9272e0..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/access/users/UserProfile.tsx
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect} from 'react';
-import {Alert, Button, Card, CardBody, CardFooter, CardHeader, Content, Form, FormAlert, FormGroup, TextInput,} from '@patternfly/react-core';
-import {SubmitHandler, useForm} from "react-hook-form";
-import {AxiosResponse} from "axios";
-import {AccessUser} from "../../../models/AccessModels";
-import {useFormUtil} from "@util/useFormUtil";
-import {EventBus} from "@features/project/designer/utils/EventBus";
-import {AccessApi} from "../../../api/AccessApi";
-import {AuthApi, getCurrentUser} from "@api/auth/AuthApi";
-
-
-function UserProfile() {
-
- const [isReset, setReset] = React.useState(false);
- const [backendError, setBackendError] = React.useState<string>();
- const formContext = useForm<AccessUser>({mode: "all"});
- const {getTextField, getPasswordField} = useFormUtil(formContext);
- const {
- formState: {errors},
- handleSubmit,
- reset,
- trigger
- } = formContext;
-
- useEffect(() => {
- AuthApi.getMe(user => {
- })
- }, []);
-
- useEffect(() => {
- var user = getCurrentUser();
- if (user) reset(user);
- setBackendError(undefined);
- setReset(true);
- }, [reset]);
-
- useEffect(() => {
- isReset && trigger();
- }, [trigger, isReset]);
-
- const onSubmit: SubmitHandler<AccessUser> = (data) => {
- AccessApi.putUser(data, after)
- }
-
- function after(result: boolean, res: AxiosResponse<AccessUser> | any) {
- if (result) {
- onSuccess(res.data);
- } else {
- const data = res?.response?.data;
- const error = data && data !== '' ? data : res?.message;
- setBackendError(error);
- }
- }
-
- function onSuccess(user: AccessUser) {
- const message = `User ${user.username} successfully updated`;
- EventBus.sendAlert("Success", message, "success");
- }
-
- function isValidEmail(input: string): boolean {
- const pattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
- return pattern.test(input);
- }
-
- function canNotSubmit() {
- return Object.getOwnPropertyNames(errors).length > 0;
- }
-
- return (
- <Card>
- <CardHeader>
- <Content component='h2'>User</Content>
- </CardHeader>
- <CardBody>
- <Form isHorizontal={true} autoComplete="off">
- <FormGroup label="Username" fieldId='username' isRequired>
- <TextInput className="text-field" type="text" id='username' value={getCurrentUser()?.username} isDisabled/>
- </FormGroup>
- {getTextField('firstName', 'First Name', {
- length: v => v.length > 0 || 'First name should not be empty',
- })}
- {getTextField('lastName', 'Last Name', {
- length: v => v.length > 0 || 'Last name should not be empty',
- })}
- {getTextField('email', 'Email', {
- length: v => v.length > 0 || 'Last name should not be empty',
- email: v => isValidEmail(v) || 'Invalid email'
- }, 'email')}
- {backendError &&
- <FormAlert>
- <Alert variant="danger" title={backendError} aria-live="polite" isInline/>
- </FormAlert>
- }
- </Form>
- </CardBody>
- <CardFooter style={{display: 'flex', justifyContent: 'flex-end'}}>
- <Button key="confirm" variant="primary"
- onClick={handleSubmit(onSubmit)}
- isDisabled={canNotSubmit()}
- >
- Save
- </Button>
- </CardFooter>
- </Card>
- )
-}
-
-export default UserProfile
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/access/users/UserProfileTab.tsx b/karavan-app/src/main/webui/src/karavan/features/access/users/UserProfileTab.tsx
deleted file mode 100644
index 9f36d4f8..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/access/users/UserProfileTab.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-import UserProfile from "@features/access/users/UserProfile";
-import {ChangePassword} from "@features/access/users/ChangePassword";
-
-export function UserProfileTab() {
-
- return (
- <div style={{padding:'16px', display:'flex', flexDirection:'column', gap:'16px', justifyContent:'center'}}>
- <UserProfile/>
- <ChangePassword/>
- </div>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/access/users/UsersTable.tsx b/karavan-app/src/main/webui/src/karavan/features/access/users/UsersTable.tsx
deleted file mode 100644
index 207337e1..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/access/users/UsersTable.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useState} from 'react';
-import {Bullseye, EmptyState, EmptyStateVariant, Spinner} from '@patternfly/react-core';
-import {InnerScrollContainer, OuterScrollContainer, Table, TableVariant, Tbody, Td, Th, Thead, Tr} from '@patternfly/react-table';
-import SearchIcon from "@patternfly/react-icons/dist/esm/icons/search-icon";
-import {shallow} from "zustand/shallow";
-import {UsersTableRow} from "./UsersTableRow";
-import {useAccessStore} from "@stores/AccessStore";
-import {AccessUser} from "@models/AccessModels";
-
-export function UsersTable() {
-
- const [users, filter] = useAccessStore((s) => [s.users, s.filter], shallow);
- const [loading] = useState<boolean>(true);
-
- function getEmptyState() {
- return (
- <Tbody>
- <Tr>
- <Td colSpan={8}>
- <Bullseye>
- {loading && <Spinner className="progress-stepper" diameter="80px" aria-label="Loading..."/>}
- {!loading &&
- <EmptyState variant={EmptyStateVariant.sm} titleText="No results found" icon={SearchIcon} headingLevel="h2"/>
- }
- </Bullseye>
- </Td>
- </Tr>
- </Tbody>
- )
- }
-
- const conts = users.filter(user =>
- user.username?.toLowerCase().includes(filter)
- || user.firstName?.toLowerCase().includes(filter)
- || user.lastName?.toLowerCase().includes(filter)
- ).sort((a, b) => a.username.localeCompare(b.username));
- return (
- <OuterScrollContainer>
- <InnerScrollContainer>
- <Table aria-label="Projects" variant={TableVariant.compact} isStickyHeader>
- <Thead>
- <Tr>
- <Th key='username'>Username</Th>
- <Th key='firstName'>First Name</Th>
- <Th key='lastName'>Last Name</Th>
- <Th key='email'>Email</Th>
- <Th key='roles'>Roles</Th>
- <Th key='status'>Status</Th>
- <Th key='action' screenReaderText='pass'></Th>
- </Tr>
- </Thead>
- {conts?.map((user: AccessUser, index: number) => (
- <UsersTableRow key={user.username} index={index} user={user}/>
- ))}
- {conts?.length === 0 && getEmptyState()}
- </Table>
- </InnerScrollContainer>
- </OuterScrollContainer>
- )
-
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/access/users/UsersTableRow.tsx b/karavan-app/src/main/webui/src/karavan/features/access/users/UsersTableRow.tsx
deleted file mode 100644
index f1dacf4c..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/access/users/UsersTableRow.tsx
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useState} from 'react';
-import {Button, capitalize, Label, Switch} from '@patternfly/react-core';
-import {Tbody, Td, Tr} from "@patternfly/react-table";
-import {AccessUser} from "../../../models/AccessModels";
-import {useAccessStore} from "../../../stores/AccessStore";
-import {shallow} from "zustand/shallow";
-import {AccessApi} from "../../../api/AccessApi";
-import DeleteIcon from "@patternfly/react-icons/dist/js/icons/times-icon";
-import {AccessService} from "@services/AccessService";
-import {ModalConfirmation} from "@shared/ui/ModalConfirmation";
-import {PauseIcon, PlayIcon, UserSecretIcon} from "@patternfly/react-icons";
-
-interface Props {
- index: number
- user: AccessUser
-}
-
-export function UsersTableRow(props: Props) {
-
- const [setShowUserModal, setCurrentUser, roles, setShowPasswordModal] = useAccessStore((s) => [s.setShowUserModal, s.setCurrentUser, s.roles, s.setShowPasswordModal], shallow);
- const [showConfirmation, setShowConfirmation] = useState<boolean>(false);
- const [command, setCommand] = useState<'activate' | 'inactivate' | 'delete' | 'add' | 'remove'>();
- const [role, setRole] = useState<string>();
-
- const user = props.user;
-
- function executeAction() {
- if (command === 'delete') {
- AccessApi.deleteUser(user.username, result => {
- AccessService.refreshAccess();
- });
- } else if (command && ['activate', 'inactivate'].includes(command)) {
- var status = command === 'inactivate' ? 'INACTIVE' : 'ACTIVE';
- AccessApi.setUserStatus(user, status, result => {
- AccessService.refreshAccess();
- });
- } else if (command && ['add', 'remove'].includes(command)) {
- AccessApi.setUserRole(user, role, command, result => {
- AccessService.refreshAccess();
- });
- }
- setShowConfirmation(false);
- }
-
- function getConfirmationText() {
- if (command === 'delete') {
- return (
- <div style={{ display: 'flex', flexDirection: 'row', gap: '4px', alignItems: 'center' }}>
- <Label color='red'>{capitalize('' + command)}</Label>
- {" user "}
- {<Label color='blue'>{user.username}</Label>}
- {" ?"}
- </div>
- )
- } else if (command === 'inactivate') {
- return (
- <div style={{ display: 'flex', flexDirection: 'row', gap: '4px', alignItems: 'center' }}>
- <Label color='red'>{capitalize('' + command)}</Label>
- {" user "}
- {<Label color='blue'>{user.username}</Label>}
- {" ?"}
- </div>
- )
- } else if (command === 'activate') {
- return (
- <div style={{ display: 'flex', flexDirection: 'row', gap: '4px', alignItems: 'center' }}>
- <Label color='green'>{capitalize('' + command)}</Label>
- {" user "}
- {<Label color='blue'>{user.username}</Label>}
- {" ?"}
- </div>
- )
- } else if (command === 'remove') {
- return (
- <div style={{ display: 'flex', flexDirection: 'row', gap: '4px', alignItems: 'center' }}>
- <Label color='red'>{capitalize('' + command)}</Label>
- {" user "}
- {<Label color='blue'>{user.username}</Label>}
- {" from role "}
- {<Label color='blue'>{role}</Label>}
- {" ?"}
- </div>
- )
- } else if (command === 'add') {
- return (
- <div style={{ display: 'flex', flexDirection: 'row', gap: '4px', alignItems: 'center' }}>
- <Label color='green'>{capitalize('' + command)}</Label>
- {" user "}
- {<Label color='blue'>{user.username}</Label>}
- {" to role "}
- {<Label color='blue'>{role}</Label>}
- {" ?"}
- </div>
- )
- }
- }
-
- const deactivatable = !['admin', 'platform'].includes(user?.username) && user.status !== 'DELETED';
- const notDeletable = ['admin', 'platform'].includes(user?.username) || user.status === 'DELETED';
- const notEditable = ['admin', 'platform'].includes(user?.username) || user.status !== 'ACTIVE'
- return (
- <Tbody>
- <Tr key={user.username} style={{verticalAlign: 'middle'}}>
- <Td>
- <Button variant='link' style={{padding: '6px'}} onClick={() => {
- setCurrentUser(user)
- setShowUserModal(true)
- }}>
- {user.username}
- </Button>
- </Td>
- <Td>{user.firstName}</Td>
- <Td>{user.lastName}</Td>
- <Td>{user.email}</Td>
- <Td modifier='fitContent'>
- <div style={{display: 'flex', flexDirection: 'column', gap: '4px'}}>
- {roles.map(role => {
- const isChecked = user.roles.includes(role.name)
- return (
- <Switch
- key={`${user.username}-${role.name}`}
- id={`${user.username}-${role.name}`}
- label={role.name}
- className='switch-role'
- isChecked={isChecked}
- ouiaId={'admin'}
- isDisabled={notEditable}
- onClick={(_) => {
- setRole(role.name);
- setCommand(isChecked ? 'remove' : 'add')
- setShowConfirmation(true);
- }}
- />
- )
- })}
- </div>
- </Td>
- <Td modifier='fitContent'>
- <Label color={user.status === 'ACTIVE' ? 'green' : (user.status === 'DELETED' ? "red" : 'grey')}>{user.status}</Label>
- </Td>
- <Td isActionCell>
- <div style={{display: 'flex', flexDirection: 'row', gap: '4px', justifyContent: 'flex-end'}}>
- {deactivatable && <Button className="dev-action-button"
- variant={"link"}
- icon={user.status === 'INACTIVE' ? <PlayIcon/> : <PauseIcon/>}
- style={{padding: '6px', marginLeft: '6px'}}
- onClick={() => {
- setCommand(user.status === 'INACTIVE' ? 'activate' : 'inactivate')
- setShowConfirmation(true);
- }}/>}
- <Button className="dev-action-button"
- isDisabled={notDeletable}
- variant={"plain"}
- icon={<DeleteIcon/>}
- style={{padding: '6px', marginLeft: '6px'}}
- onClick={() => {
- setCommand('delete')
- setShowConfirmation(true);
- }}/>
- <Button className="dev-action-button"
- isDisabled={notDeletable}
- variant={"plain"}
- icon={<UserSecretIcon color={notDeletable ? 'var(--pf-t--global--icon--color--disabled)' : 'var(--pf-t--global--icon--color--status--danger--default)'}/>}
- style={{padding: '6px', marginLeft: '6px'}}
- onClick={() => {
- setCurrentUser(user)
- setShowPasswordModal(true);
- }}/>
- </div>
- </Td>
- </Tr>
- {showConfirmation &&
- <ModalConfirmation
- isOpen={showConfirmation}
- message={getConfirmationText()}
- btnConfirm='Confirm'
- btnConfirmVariant='danger'
- onConfirm={() => {
- setCommand(undefined);
- setRole(undefined);
- setShowConfirmation(false);
- executeAction();
- }}
- onCancel={() => setShowConfirmation(false)}
- />
- }
- </Tbody>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/documentation/Documentation.css b/karavan-app/src/main/webui/src/karavan/features/documentation/Documentation.css
deleted file mode 100644
index 8b477627..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/documentation/Documentation.css
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.karavan .documentation-section {
- height: 100%;
- overflow: auto;
-}
-.karavan .documentation-section .documentation-card {
- cursor: pointer;
- height: 160px;
-}
-
-.karavan .documentation-section .documentation-card .pf-v6-c-card__header {
- padding: 8px;
-}
-
-.karavan .documentation-section .documentation-card .pf-v6-c-card__header .custom {
- margin-left: auto;
-}
-
-.karavan .documentation-section .documentation-card .pf-v6-c-card__header .pf-v6-c-card__header-main {
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 8px;
-}
-
-.karavan .documentation-section .documentation-card .pf-v6-c-card__title {
- font-size: 15px;
- font-weight: 400;
-}
-
-.karavan .documentation-section .documentation-card .pf-v6-c-card__body {
- overflow: hidden;
- position: relative;
- line-height: 1.6em;
- padding-left: 8px;
-}
-
-.documentation-section .documentation-card .icon {
- height: 24px;
- max-width: 24px;
- margin-top: auto;
- margin-bottom: auto;
- border: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -o-user-select: none;
- user-select: none;
-}
-
-.pf-v6-theme-dark .documentation-section .documentation-card .icon {
- background-color: var(--pf-t--color--gray--40);
- border-color: var(--pf-t--color--gray--40);
- border-style: solid;
- border-width: 1px;
- border-radius: 24px;
-}
-
-.karavan .documentation-section .documentation-card .header-labels {
- padding: 5px;
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
-}
-
-.karavan .documentation-section .documentation-card .header-labels .pf-v6-c-card__header-main {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
-}
-
-.karavan .documentation-section .documentation-card .footer-labels {
- padding: 5px;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
-}
-
-.karavan .documentation-section .documentation-card .version,
-.karavan .documentation-section .documentation-card .support-type,
-.karavan .documentation-section .documentation-card .support-level {
- white-space: nowrap;
-}
-
-.karavan .documentation-section .documentation-card .labels {
- opacity: 0.5;
- font-weight: 200;
-}
-
-.karavan .documentation-section .documentation-card:hover .labels {
- opacity: 1;
-}
-
-.documentation-section .documentation-card .block-checkbox {
- align-self: center;
- margin-left: 6px;
-}
-
-.documentation-section .documentation-card .pf-v6-c-card__body {
- padding-bottom: 0;
- height: 54px;
-}
-
-.documentation-section .documentation-card .pf-v6-c-card__body {
- padding-bottom: 0;
- height: 54px;
-}
-
-.documentation-section .documentation-card p {
- overflow: hidden;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- color: var(--pf-t--global--text--color--subtle);
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/documentation/DocumentationPage.tsx b/karavan-app/src/main/webui/src/karavan/features/documentation/DocumentationPage.tsx
deleted file mode 100644
index 8e875075..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/documentation/DocumentationPage.tsx
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect, useState} from 'react';
-import {Badge, capitalize, Content, Flex, FlexItem, Nav, NavItem, NavList, Switch, TextInput} from "@patternfly/react-core";
-import {KameletsTab} from "./kamelets/KameletsTab";
-import {EipTab} from "./eip/EipTab";
-import {ComponentsTab} from "./components/ComponentsTab";
-import {KameletApi} from "@karavan-core/api/KameletApi";
-import {KameletModel} from "@karavan-core/model/KameletModels";
-import {ComponentApi} from "@karavan-core/api/ComponentApi";
-import {CamelModelMetadata, ElementMeta} from "@karavan-core/model/CamelMetadata";
-import {RightPanel} from "@shared/ui/RightPanel";
-import './Documentation.css'
-import {ProjectService} from "@services/ProjectService";
-import {ProjectType} from "@models/ProjectModels";
-import {useFilesStore} from "@stores/ProjectStore";
-import {shallow} from "zustand/shallow";
-import {extractTitleFromMarkdown} from "@util/StringUtils";
-import MarkdownPreview from "@uiw/react-markdown-preview";
-import {ErrorBoundaryWrapper} from "@shared/ui/ErrorBoundaryWrapper";
-import {useTheme} from "@app/theme/ThemeContext";
-import {SourcesTab} from "@features/project/files/SourcesTab";
-
-const BUILD_IN_DOCUMENTATION_PAGES = ['processors', 'components', 'kamelets', 'source']
-
-export const DocumentationPage = () => {
-
- const {isDark} = useTheme();
- const [files] = useFilesStore((s) => [s.files], shallow);
- const [pages, setPages] = useState<string[]>(BUILD_IN_DOCUMENTATION_PAGES);
- const [pageNames, setPageNames] = useState<string[]>(BUILD_IN_DOCUMENTATION_PAGES.map(item => capitalize(item)));
- const [filter, setFilter] = useState<string>("");
- const [markdown, setMarkdown] = useState<string>("");
- const [customOnly, setCustomOnly] = useState<boolean>(false);
- const [activeItem, setActiveItem] = useState<string>();
-
- const onSelect = (_event: React.FormEvent<HTMLInputElement>, result: { itemId: number | string }) => {
- const item = result.itemId?.toString();
- setActiveItem(item);
- }
-
- useEffect(() => {
- ProjectService.refreshProjectFiles(ProjectType.documentation)
- }, []);
-
- useEffect(() => {
- if (!activeItemIsBuildIn()) {
- const m = files.filter(f => f.name === activeItem)?.[0]?.code || '';
- setMarkdown(m)
- }
- }, [activeItem]);
-
- useEffect(() => {
- const newPages: string[] = [];
- const newPageNames: string[] = [];
- files.filter(file => file.name.endsWith(".md")).sort((a, b) => a.name > b.name ? 1 : -1).forEach(file => {
- newPages.push(file.name);
- newPageNames.push(extractTitleFromMarkdown(file.code) || file.name);
- });
- newPages.push(...BUILD_IN_DOCUMENTATION_PAGES);
- newPageNames.push(...BUILD_IN_DOCUMENTATION_PAGES.map(item => capitalize(item)));
- setPages(newPages);
- setPageNames(newPageNames);
- setActiveItem(newPages[0])
- }, [files]);
-
- let kameletList: KameletModel[] = KameletApi.getAllKamelets().filter(kamelet =>
- kamelet.spec.definition.title.toLowerCase().includes(filter.toLowerCase()));
- if (customOnly) kameletList = kameletList.filter(k => KameletApi.getCustomKameletNames().includes(k.metadata.name));
-
- const components = ComponentApi.getComponents().filter(c => {
- return c.component?.name?.toLowerCase().includes(filter.toLowerCase())
- || c.component?.title?.toLowerCase().includes(filter.toLowerCase())
- || c.component?.description?.toLowerCase().includes(filter.toLowerCase())
- }).sort((a, b) => (a.component.title?.toLowerCase() > b.component.title?.toLowerCase() ? 1 : -1));
-
- const elements = CamelModelMetadata
- .filter(c => c.name.toLowerCase().includes(filter.toLowerCase())).sort((a: ElementMeta, b: ElementMeta) => a.name > b.name ? 1 : -1);
-
- function activeItemIsBuildIn() {
- return activeItem && BUILD_IN_DOCUMENTATION_PAGES.includes(activeItem);
- }
- function getNavigation() {
- const lengths: any = {
- 'processors': elements.length,
- 'components': components.length,
- 'kamelets': kameletList.length,
- }
- return (
- <Nav onSelect={onSelect} aria-label="Nav" variant="horizontal" className='documentation-navigation'>
- <NavList>
- {pages.map((item, i) => {
- const showBadge = BUILD_IN_DOCUMENTATION_PAGES.includes(item);
- return (
- <NavItem key={item} preventDefault itemId={item} isActive={activeItem === item} to="#">
- <div style={{cursor: 'pointer'}}>
- {pageNames[i]}
- {showBadge && <Badge className={`nav-label label-${item.substring(0, item.length - 1)}`}>{lengths[item]}</Badge>}
- </div>
- </NavItem>
- )
- })}
- </NavList>
- </Nav>
- )
- }
-
- function title() {
- return <Content>
- <Content component="h2">Documentation</Content>
- </Content>
- }
-
- function getTools() {
- return <div>
- <Flex>
- {activeItem === 'kamelets' && <FlexItem>
- <Switch
- label="Custom only"
- isChecked={customOnly}
- onChange={(_event, checked) => setCustomOnly(checked)}
- />
- </FlexItem>}
- <FlexItem>
- <TextInput className="text-field" type="search" id="search" name="search"
- value={filter}
- onChange={(_event, value) => setFilter(value)}
- autoComplete="off"
- placeholder="Search by name"/>
- </FlexItem>
- </Flex>
- </div>
- }
-
- return (
- <RightPanel
- title={title()}
- toolsStart={getNavigation()}
- tools={activeItemIsBuildIn() ? getTools() : undefined}
- mainPanel={
- <div className="right-panel-card">
- <div className="documentation-section">
- {activeItem === 'kamelets' && <KameletsTab kameletList={kameletList}/>}
- {activeItem === 'processors' && <EipTab elements={elements}/>}
- {activeItem === 'components' && <ComponentsTab components={components}/>}
- {activeItem === 'source' && <SourcesTab />}
- {!activeItemIsBuildIn() &&
- <ErrorBoundaryWrapper onError={error => console.error((error))}>
- <MarkdownPreview key={"DocumentationMarkdownPreview"} source={markdown} wrapperElement={{'data-color-mode': isDark ? 'dark' : 'light'}}/>
- </ErrorBoundaryWrapper>
- }
- </div>
- </div>
- }
- />
- )
-
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/documentation/components/ComponentCard.tsx b/karavan-app/src/main/webui/src/karavan/features/documentation/components/ComponentCard.tsx
deleted file mode 100644
index f24bfe5a..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/documentation/components/ComponentCard.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-import {Badge, Card, CardBody, CardFooter, CardHeader, CardTitle, Content, Flex} from '@patternfly/react-core';
-import {CamelUi} from "@features/project/designer/utils/CamelUi";
-import {Component} from "@karavan-core/model/ComponentModels";
-import {useDocumentationStore} from "../../../stores/DocumentationStore";
-import {shallow} from "zustand/shallow";
-
-interface Props {
- component: Component,
-}
-
-export function ComponentCard(props: Props) {
-
- const [setComponent, setModalOpen] = useDocumentationStore((s) => [s.setComponent, s.setModalOpen], shallow)
- const component = props.component;
-
- function click(event: React.MouseEvent) {
- const {target} = event;
- if (!(target as HTMLElement).parentElement?.className.includes("block-checkbox")) {
- setComponent(component)
- setModalOpen(true);
- }
- }
-
- const isRemote = component.component.remote;
- const classNameBadge = 'label-component' + (component.component.supportLevel !== 'Stable' ? '-preview' : '')
- return (
- <Card isCompact key={component.component.name} className="documentation-card"
- onClick={event => click(event)}
- >
- <CardHeader className="header-labels">
- <Flex style={{width: '100%'}} gap={{default: 'gapSm'}} justifyContent={{default: 'justifyContentSpaceBetween'}}>
- <Badge className={classNameBadge}>Component</Badge>
- <Badge isRead className="support-level labels">{component.component.supportLevel}</Badge>
- </Flex>
- </CardHeader>
- <CardHeader>
- {CamelUi.getIconForComponent(component.component.title, component.component.label)}
- <CardTitle>{component.component.title}</CardTitle>
- </CardHeader>
- <CardBody>
- <Content component="p" className="-pf-v6-u-color-200">{component.component.description}</Content>
- </CardBody>
- <CardFooter className="footer-labels">
- <Badge isRead className="labels">{component.component.label}</Badge>
- <Badge isRead className="labels">{isRemote ? 'remote' : 'internal'}</Badge>
- </CardFooter>
- </Card>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/documentation/components/ComponentModal.tsx b/karavan-app/src/main/webui/src/karavan/features/documentation/components/ComponentModal.tsx
deleted file mode 100644
index 5bae27e7..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/documentation/components/ComponentModal.tsx
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useState} from 'react';
-import {Badge, Button, CardHeader, Content, Flex, Modal, ModalBody, ModalFooter, ModalHeader, Tab, Tabs, TabTitleText} from '@patternfly/react-core';
-
-import '@features/project/designer/karavan.css';
-import {Table, Tbody, Td, Th, Thead, Tr} from "@patternfly/react-table";
-import {CamelUi} from "@features/project/designer/utils/CamelUi";
-import {ComponentApi} from "@karavan-core/api/ComponentApi";
-import {ComponentHeader, ComponentProperty} from "@karavan-core/model/ComponentModels";
-import {useDocumentationStore} from "../../../stores/DocumentationStore";
-import {shallow} from "zustand/shallow";
-
-export function ComponentModal() {
-
- const [component, isModalOpen, setModalOpen] = useDocumentationStore((s) =>
- [s.component, s.isModalOpen, s.setModalOpen], shallow)
-
- const [tab, setTab] = useState<string | number>('properties');
-
- const props = new Map<string, ComponentProperty>();
- if (component) {
- ComponentApi.getComponentProperties(component?.component.name, "consumer").forEach(cp => props.set(cp.name, cp));
- ComponentApi.getComponentProperties(component?.component.name, "producer").forEach(cp => props.set(cp.name, cp));
- }
-
- const headers = new Map<string, ComponentHeader>();
- if (component) {
- ComponentApi.getComponentHeaders(component?.component.name, "consumer").forEach(cp => headers.set(cp.name, cp));
- ComponentApi.getComponentHeaders(component?.component.name, "producer").forEach(cp => headers.set(cp.name, cp));
- }
-
-
- function getPropertiesTable() {
- return (
- <Table aria-label="Properties table" variant='compact'>
- <Thead>
- <Tr>
- <Th key='name'>Display Name / Name</Th>
- <Th key='desc'>Description</Th>
- <Th key='type'>Type</Th>
- <Th key='label'>Label</Th>
- </Tr>
- </Thead>
- <Tbody>
- {Array.from(props.values()).map((p: ComponentProperty, idx: number) => (
- <Tr key={idx}>
- <Td key={`${idx}_name`}>
- <div>
- <b>{p.displayName}</b>
- <div>{p.name}</div>
- </div>
- </Td>
- <Td key={`${idx}_desc`}>
- <div>
- <div>{p.description}</div>
- {p.defaultValue && p.defaultValue.toString().length > 0 &&
- <div>{"Default value: " + p.defaultValue}</div>}
- </div>
- </Td>
- <Td key={`${idx}_type`}>{p.type}</Td>
- <Td key={`${idx}_label`}>{p.label}</Td>
- </Tr>
- ))}
- </Tbody>
- </Table>
- )
- }
-
- function getHeadersTable() {
- return (
- <Table aria-label="Headers table" variant='compact'>
- <Thead>
- <Tr>
- <Th key='name'>Name</Th>
- <Th key='desc' modifier={"breakWord"}>Description</Th>
- <Th key='type'>Group</Th>
- <Th key='label'>Java Type</Th>
- <Th key='label'>Default Value</Th>
- <Th key='label'>Autowired</Th>
- </Tr>
- </Thead>
- <Tbody>
- {Array.from(headers.values()).map((p: ComponentHeader, idx: number) => (
- <Tr key={idx}>
- <Td key={`${idx}_name`}>
- <div>
- <b>{p.displayName}</b>
- <div>{p.name}</div>
- </div>
- </Td>
- <Td key={`${idx}_type`}>{p.description}</Td>
- <Td key={`${idx}_label`}>{p.group}</Td>
- <Td key={`${idx}_label`}>{p.javaType}</Td>
- <Td key={`${idx}_label`}>{p.defaultValue}</Td>
- <Td key={`${idx}_label`}>{p.autowired}</Td>
- </Tr>
- ))}
- </Tbody>
- </Table>
- )
- }
-
- const showProps = props.size !== 0;
- const showHeaders = headers.size !== 0;
-
- return (
- <Modal
- aria-label={"Component"}
- isOpen={isModalOpen}
- onClose={() => setModalOpen(false)}
- >
- <ModalHeader title={component?.component.title}/>
- <ModalBody>
- <Flex direction={{default: 'column'}} key={component?.component.name}
- className="kamelet-modal-card">
- <CardHeader actions={{
- actions: <><Badge className="badge"
- isRead> {component?.component.label}</Badge></>,
- hasNoOffset: false,
- className: undefined
- }}>
- {component && CamelUi.getIconForComponent(component.component.title, component.component.label)}
-
- </CardHeader>
- <Content component="p" className="description">{component?.component.description}</Content>
- <Tabs
- activeKey={tab}
- onSelect={(event, eventKey) => setTab(eventKey)}
- aria-label="Tabs in the default example"
- role="region"
- >
- <Tab eventKey={'properties'} title={<TabTitleText>Properties</TabTitleText>}/>
- <Tab eventKey={'headers'} title={<TabTitleText>Headers</TabTitleText>}/>
- </Tabs>
- {tab === 'properties' && showProps && getPropertiesTable()}
- {tab === 'headers' && showHeaders && getHeadersTable()}
- </Flex>
- </ModalBody>
- <ModalFooter>
- <Button key="cancel" variant="primary"
- onClick={e => setModalOpen(false)}>Close</Button>
- </ModalFooter>
- </Modal>
- )
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/documentation/components/ComponentsTab.tsx b/karavan-app/src/main/webui/src/karavan/features/documentation/components/ComponentsTab.tsx
deleted file mode 100644
index 849c072e..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/documentation/components/ComponentsTab.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-import {Gallery} from '@patternfly/react-core';
-import {ComponentCard} from "./ComponentCard";
-import {ComponentModal} from "./ComponentModal";
-import {shallow} from "zustand/shallow";
-import {useDocumentationStore} from "../../../stores/DocumentationStore";
-import {Component} from '@karavan-core/model/ComponentModels';
-
-interface Props {
- components: Component[],
-}
-
-export function ComponentsTab(props: Props) {
-
- const [isModalOpen] = useDocumentationStore((s) => [s.isModalOpen], shallow)
-
- const {components} = props;
- return (
- <div className="documentation-eip-section">
- {isModalOpen && <ComponentModal/>}
- <div className="kamelets-page">
- <Gallery hasGutter>
- {components.map(c => (
- <ComponentCard key={c.component.name} component={c}/>
- ))}
- </Gallery>
- </div>
- </div>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/documentation/eip/EipCard.tsx b/karavan-app/src/main/webui/src/karavan/features/documentation/eip/EipCard.tsx
deleted file mode 100644
index 6f7f3ae2..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/documentation/eip/EipCard.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-import {Badge, Card, CardBody, CardFooter, CardHeader, CardTitle, Content} from '@patternfly/react-core';
-import {CamelUi} from "@features/project/designer/utils/CamelUi";
-import {ElementMeta} from "@karavan-core/model/CamelMetadata";
-import {useDocumentationStore} from "../../../stores/DocumentationStore";
-import {shallow} from "zustand/shallow";
-
-interface Props {
- element: ElementMeta,
-}
-
-export function EipCard(props: Props) {
-
- const [setElement, setModalOpen] = useDocumentationStore((s) =>
- [s.setElement, s.setModalOpen], shallow)
-
- const element = props.element;
-
- function click (event: React.MouseEvent) {
- setElement(element)
- setModalOpen(true);
- }
- return (
- <Card isCompact key={element.name} className="documentation-card" onClick={event => click(event)}>
- <CardHeader>
- <Badge className='label-processor'>Processor</Badge>
- </CardHeader>
- <CardHeader>
- {CamelUi.getIconForDslName(element.className)}
- <CardTitle>{element.title}</CardTitle>
- </CardHeader>
- <CardBody>
- <Content component="p">{element.description}</Content>
- </CardBody>
- <CardFooter className="footer-labels">
- <div>
- {element.labels.split(',').map((s: string, i: number) => <Badge key={s + i} isRead
- className="labels">{s}</Badge>)}
- </div>
- </CardFooter>
- </Card>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/documentation/eip/EipModal.tsx b/karavan-app/src/main/webui/src/karavan/features/documentation/eip/EipModal.tsx
deleted file mode 100644
index 85ccc71d..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/documentation/eip/EipModal.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-import {Badge, Button, CardHeader, CardTitle, Content, Flex, Modal, ModalBody, ModalFooter, ModalHeader} from '@patternfly/react-core';
-
-import '@features/project/designer/karavan.css';
-import {Table, Tbody, Td, Th, Thead, Tr} from "@patternfly/react-table";
-import {CamelUi} from "@features/project/designer/utils/CamelUi";
-import {PropertyMeta} from "@karavan-core/model/CamelMetadata";
-import {useDocumentationStore} from "../../../stores/DocumentationStore";
-import {shallow} from "zustand/shallow";
-
-
-export function EipModal() {
-
- const [element, isModalOpen, setModalOpen] = useDocumentationStore((s) =>
- [s.element, s.isModalOpen, s.setModalOpen], shallow)
-
- return (
- <Modal
- aria-label={"Processor"}
- isOpen={isModalOpen}
- onClose={() => setModalOpen(false)}
- >
- <ModalHeader title={element?.title}/>
- <ModalBody>
- <Flex direction={{default: 'column'}} key={element?.name} className="kamelet-modal-card">
- <CardHeader actions={{
- actions: <><Badge className="badge"
- isRead> {element?.labels}</Badge></>, hasNoOffset: false, className: undefined
- }}>
- {element && CamelUi.getIconForDslName(element?.className)}
-
- </CardHeader>
- <Content component="p" className="description">{element?.description}</Content>
- {element?.properties.length !== 0 &&
- <div>
- <CardTitle>Properties</CardTitle>
- <Table aria-label="Simple table" variant='compact'>
- <Thead>
- <Tr>
- <Th key='name' width={10}>Name</Th>
- <Th key='label'>Label</Th>
- <Th key='display' width={10}>Display Name</Th>
- <Th key='desc'>Description</Th>
- <Th key='type'>Type</Th>
- </Tr>
- </Thead>
- <Tbody>
- {element?.properties.map((p: PropertyMeta, idx: number) => (
- <Tr key={idx}>
- <Td modifier={"fitContent"}>
- {p.name}
- </Td>
- <Td modifier={"fitContent"}>
- <Badge className="badge" isRead>{p.label}</Badge>
- </Td>
- <Td modifier={"fitContent"}>
- {p.displayName}
- </Td>
- <Td key={`${idx}_desc`}>
- <div>
- <div>{p.description}</div>
- {p.defaultValue && p.defaultValue.toString().length > 0 && <div>{"Default value: " + p.defaultValue}</div>}
- </div>
- </Td>
- <Td key={`${idx}_type`}>{p.type}</Td>
- </Tr>
- ))}
- </Tbody>
- </Table>
- </div>
- }
- </Flex>
- </ModalBody>
- <ModalFooter>
- <Button key="cancel" variant="primary" onClick={e => setModalOpen(false)}>Close</Button>
- </ModalFooter>
- </Modal>
- )
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/documentation/eip/EipTab.tsx b/karavan-app/src/main/webui/src/karavan/features/documentation/eip/EipTab.tsx
deleted file mode 100644
index caefae21..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/documentation/eip/EipTab.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-import {Gallery,} from '@patternfly/react-core';
-import {EipCard} from "./EipCard";
-import {EipModal} from "./EipModal";
-import {useDocumentationStore} from "../../../stores/DocumentationStore";
-import {shallow} from "zustand/shallow";
-import {ElementMeta} from "@karavan-core/model/CamelMetadata";
-
-interface Props {
- elements: ElementMeta[],
-}
-
-export function EipTab(props: Props) {
-
- const [isModalOpen] = useDocumentationStore((s) => [s.isModalOpen], shallow)
-
- const { elements } = props;
-
- return (
- <div className="documentation-eip-section">
- {isModalOpen && <EipModal/>}
- <div className="kamelets-page">
- <Gallery hasGutter>
- {elements.map(c => (
- <EipCard key={c.name} element={c}/>
- ))}
- </Gallery>
- </div>
- </div>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/documentation/kamelets/KameletCard.tsx b/karavan-app/src/main/webui/src/karavan/features/documentation/kamelets/KameletCard.tsx
deleted file mode 100644
index 4292c22d..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/documentation/kamelets/KameletCard.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-import {Badge, Card, CardBody, CardFooter, CardHeader, CardTitle, Flex} from '@patternfly/react-core';
-import {KameletModel} from "@karavan-core/model/KameletModels";
-import {CamelUi} from "@features/project/designer/utils/CamelUi";
-import {KameletApi} from "@karavan-core/api/KameletApi";
-import {useDocumentationStore} from "../../../stores/DocumentationStore";
-import {shallow} from "zustand/shallow";
-
-interface Props {
- kamelet: KameletModel,
-}
-
-export function KameletCard(props: Props) {
-
- const [setKamelet, setModalOpen] = useDocumentationStore((s) => [s.setKamelet, s.setModalOpen], shallow)
-
- const kamelet = props.kamelet;
- const isCustom = KameletApi.getCustomKameletNames().includes(kamelet.metadata.name);
-
- function click(event: React.MouseEvent) {
- const { target } = event;
- if (!(target as HTMLElement).parentElement?.className.includes("block-checkbox")) {
- setKamelet(kamelet)
- setModalOpen(true);
- }
-
- }
-
- const supportLevel = kamelet.metadata.annotations["camel.apache.org/kamelet.support.level"];
- const classNameBadge = 'label-kamelet' + (supportLevel !== 'Stable' ? '-preview' : '')
- return (
- <Card isCompact key={kamelet.metadata.name} className="documentation-card"
- onClick={event => click(event)}
- >
- <CardHeader className="header-labels">
- <Flex style={{width:'100%'}} gap={{default:'gapSm'}} justifyContent={{default: 'justifyContentSpaceBetween'}}>
- <Badge className={classNameBadge}>Kamelet</Badge>
- <Badge isRead className="support-level labels">{kamelet.metadata.annotations["camel.apache.org/kamelet.support.level"]}</Badge>
- </Flex>
- </CardHeader>
- <CardHeader>
- {CamelUi.getIconFromSource(kamelet.icon())}
- <CardTitle>{kamelet.spec.definition.title}</CardTitle>
- </CardHeader>
- <CardBody>{kamelet.spec.definition.description}</CardBody>
- <CardFooter className="footer-labels">
- <Badge isRead className="labels">{kamelet.metadata.labels["camel.apache.org/kamelet.type"].toLowerCase()}</Badge>
- {isCustom && <Badge className="custom labels">custom</Badge>}
- </CardFooter>
- </Card>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/documentation/kamelets/KameletModal.tsx b/karavan-app/src/main/webui/src/karavan/features/documentation/kamelets/KameletModal.tsx
deleted file mode 100644
index c78a4217..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/documentation/kamelets/KameletModal.tsx
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-import {Badge, Button, CardHeader, CardTitle, Content, Flex, Modal, ModalBody, ModalFooter, ModalHeader} from '@patternfly/react-core';
-import {Property} from "@karavan-core/model/KameletModels";
-import {Table, Tbody, Td, Th, Thead, Tr} from "@patternfly/react-table";
-import {CamelUi} from "@features/project/designer/utils/CamelUi";
-import {useDocumentationStore} from "../../../stores/DocumentationStore";
-import {shallow} from "zustand/shallow";
-
-export function KameletModal() {
-
- const [kamelet, isModalOpen, setModalOpen] = useDocumentationStore((s) =>
- [s.kamelet, s.isModalOpen, s.setModalOpen], shallow)
-
- function getKameletProperties (properties: any): any[] {
- return properties
- ? Array.from(new Map(Object.entries(properties)), ([name, value]) => (value))
- : [];
- }
-
- return (
- <Modal
- aria-label={"Kamelet"}
- isOpen={isModalOpen}
- onClose={() => setModalOpen(false)}
- >
- <ModalHeader title={kamelet?.spec.definition.title}/>
- <ModalBody>
- <Flex direction={{default: 'column'}} key={kamelet?.metadata.name}
- className="kamelet-modal-card">
- <CardHeader actions={{ actions: <><Badge className="badge"
- isRead> {kamelet?.metadata.labels["camel.apache.org/kamelet.type"].toLowerCase()}</Badge></>, hasNoOffset: false, className: undefined}} >
- {kamelet && CamelUi.getIconFromSource(kamelet?.icon())}
-
- </CardHeader>
- <Content component="p" className="description">{kamelet?.spec.definition.description}</Content>
- {kamelet?.spec.definition.properties && kamelet?.spec.definition.properties.length !== 0 &&
- <div>
- <CardTitle>Properties</CardTitle>
- <Table aria-label="Simple table" variant='compact'>
- <Thead>
- <Tr>
- <Th key='title'>Title</Th>
- <Th key='type'>Type</Th>
- <Th key='desc'>Description</Th>
- <Th key='format'>Format</Th>
- <Th key='example'>Example</Th>
- </Tr>
- </Thead>
- <Tbody>
- {getKameletProperties(kamelet?.spec.definition.properties).map((p: Property, idx: number) => (
- <Tr key={idx}>
- <Td key={`${idx}_title`}>{p.title}</Td>
- <Td key={`${idx}_type`}>{p.type}</Td>
- <Td key={`${idx}_desc`}>{p.description}</Td>
- <Td key={`${idx}_format`}>{p.format}</Td>
- <Td key={`${idx}_example`}>{p.example}</Td>
- </Tr>
- ))}
- </Tbody>
- </Table>
- </div>
- }
- </Flex>
- </ModalBody>
- <ModalFooter>
- <Button key="cancel" variant="primary"
- onClick={e => setModalOpen(false)}>Close</Button>
- </ModalFooter>
- </Modal>
- )
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/documentation/kamelets/KameletsTab.tsx b/karavan-app/src/main/webui/src/karavan/features/documentation/kamelets/KameletsTab.tsx
deleted file mode 100644
index de298d6c..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/documentation/kamelets/KameletsTab.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-import {Gallery} from '@patternfly/react-core';
-import {KameletCard} from "./KameletCard";
-import {KameletModal} from "./KameletModal";
-import {useDocumentationStore} from "../../../stores/DocumentationStore";
-import {shallow} from "zustand/shallow";
-import {KameletModel} from "@karavan-core/model/KameletModels";
-
-interface Props {
- kameletList: KameletModel[],
-}
-
-export function KameletsTab(props: Props) {
-
- const [isModalOpen] = useDocumentationStore((s) => [s.isModalOpen], shallow)
-
- const {kameletList} = props;
-
- return (
- <div className="documentation-eip-section">
- {isModalOpen && <KameletModal/>}
- <div className="kamelets-page">
- <Gallery hasGutter>
- {kameletList.map(k => (
- <KameletCard key={k.metadata.name} kamelet={k}/>
- ))}
- </Gallery>
- </div>
- </div>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/ContainerLogTab.tsx b/karavan-app/src/main/webui/src/karavan/features/project/ContainerLogTab.tsx
deleted file mode 100644
index a2e76368..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/ContainerLogTab.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import React, {useEffect, useRef, useState} from 'react';
-import {useSelectedContainerStore} from "@stores/ProjectStore";
-import {shallow} from "zustand/shallow";
-import {LogWatchApi} from "@api/LogWatchApi";
-import {LogViewer, LogViewerSearch} from '@patternfly/react-log-viewer';
-import {Button, Checkbox, Tooltip, TooltipPosition} from "@patternfly/react-core";
-import {ProjectEventBus} from "@bus/ProjectEventBus";
-import {TrashAltIcon} from "@patternfly/react-icons";
-import {ProjectContainerContextToolbar} from "@features/project/ProjectContainerContextToolbar";
-import {useLogStore} from "@stores/LogStore";
-
-export function ContainerLogTab() {
-
- const [selectedContainerName] = useSelectedContainerStore((s) => [s.selectedContainerName]);
- const logViewerRef = useRef(null);
- const [data, setData] = useLogStore((state) => [state.data, state.setData], shallow);
-
- const [isTextWrapped, setIsTextWrapped] = useState(true);
- const [autoScroll, setAutoScroll] = useState(true);
- const showLogger = selectedContainerName !== undefined && selectedContainerName !== null;
- const [controller, setController] = React.useState(new AbortController());
-
- useEffect(() => {
- setData([]);
- controller.abort()
- const c = new AbortController();
- setController(c);
- if (selectedContainerName) {
- const f = LogWatchApi.fetchData('container', selectedContainerName, c).then(_ => {
- });
- }
- return () => {
- c.abort();
- };
- }, [selectedContainerName]);
-
- function getToolbar() {
- return (
- <div style={{display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '8px', paddingRight: '16px'}}>
- <LogViewerSearch placeholder={'search'} minSearchChars={4} style={{width: "400px"}}/>
- <Tooltip content={"Clean log"} position={TooltipPosition.bottom}>
- <Button variant="plain" onClick={() => ProjectEventBus.sendLog('set', '')} icon={<TrashAltIcon/>}/>
- </Tooltip>
- <Checkbox label="Wrap text" aria-label="wrap text checkbox" isChecked={isTextWrapped}
- id="wrap-text-checkbox"
- onChange={(_, checked) => setIsTextWrapped(checked)}/>
- <Checkbox label="Autoscroll" aria-label="autoscroll checkbox" isChecked={autoScroll}
- id="autoscroll-checkbox"
- onChange={(_, checked) => setAutoScroll(checked)}/>
- </div>
- );
- }
-
-
- const FooterButton = () => {
- const handleClick = () => {
- logViewerRef.current.scrollToBottom();
- };
- return (
- <div style={{display: 'flex', flexDirection: 'row', justifyContent:'center', alignItems: 'center', gap: '8px'}}>
- <Button variant={'link'} onClick={handleClick}>Jump to the bottom</Button>
- </div>
- );
- };
-
- const currentLine = data.length > 0 ? data.length - 1 : 0;
- return (
- <LogViewer
- ref={logViewerRef}
- isTextWrapped={isTextWrapped}
- hasLineNumbers={false}
- loadingContent={"Loading..."}
- height={"100vh"}
- data={showLogger && data.length > 0 ? data : []}
- scrollToRow={autoScroll ? currentLine : undefined}
- theme={'dark'}
- toolbar={<ProjectContainerContextToolbar additionalTools={getToolbar()}/>}
- footer={<FooterButton />}
- />
- );
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/DesignerToggle.tsx b/karavan-app/src/main/webui/src/karavan/features/project/DesignerToggle.tsx
deleted file mode 100644
index 9eaf8be3..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/DesignerToggle.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import React from 'react';
-import {ToggleGroup, ToggleGroupItem,} from '@patternfly/react-core';
-import {useFileStore} from "@stores/ProjectStore";
-import {shallow} from "zustand/shallow";
-import {useDesignerStore} from "@features/project/designer/DesignerStore";
-import {getProjectFileTypeByName} from "@models/ProjectModels";
-import {CodeIcon} from "@patternfly/react-icons/dist/esm/icons";
-import {DeploymentPattern} from "@carbon/icons-react";
-
-export function DesignerToggle() {
-
- const [file] = useFileStore((s) => [s.file], shallow);
- const [setDesignerSwitch, designerSwitch] = useDesignerStore((s) => [s.setDesignerSwitch, s.designerSwitch], shallow)
-
- const fileType = getProjectFileTypeByName(file?.name || "");
- const showDesignerSwitch = fileType.filter(ft => ['INTEGRATION', 'KAMELET', 'OPENAPI' , 'ASYNCAPI'].includes(ft.name)).length > 0;
-
- return (
- <ToggleGroup aria-label="DesignerToggle" className={"designer-toggle"}>
- <ToggleGroupItem
- icon={<DeploymentPattern className='carbon'/>}
- aria-label="designer"
- text='Designer'
- buttonId="toggle-group-icons-1"
- isSelected={designerSwitch}
- isDisabled={!showDesignerSwitch}
- onChange={(_, __) => setDesignerSwitch(true)}
- />
- <ToggleGroupItem
- icon={<CodeIcon/>}
- text='Code'
- aria-label="code"
- buttonId="toggle-group-icons-2"
- isSelected={!designerSwitch}
- onChange={(_, __) => setDesignerSwitch(false)}
- />
- </ToggleGroup>
- )
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/FileSearchToolbarItem.tsx b/karavan-app/src/main/webui/src/karavan/features/project/FileSearchToolbarItem.tsx
deleted file mode 100644
index 4feeaea9..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/FileSearchToolbarItem.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import React, {useEffect} from 'react';
-import {Button, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities} from '@patternfly/react-core';
-import {shallow} from "zustand/shallow";
-import {useSearchStore} from "@stores/SearchStore";
-import {SearchApi} from "@api/SearchApi";
-import TimesIcon from "@patternfly/react-icons/dist/esm/icons/times-icon";
-import {useDebounceValue} from "usehooks-ts";
-
-export function FileSearchToolbarItem(props: {disabled: boolean}) {
-
- const [search, setSearch, setSearchResults] = useSearchStore((s) => [s.search, s.setSearch, s.setSearchResults], shallow)
- const [debouncedSearch] = useDebounceValue(search, 300);
-
- useEffect(() => {
- if (search !== undefined && search !== '') {
- SearchApi.searchAll(search, response => {
- if (response) {
- setSearchResults(response);
- }
- })
- } else {
- setSearchResults([])
- }
- }, [debouncedSearch]);
-
- function searchInput() {
- return (
- <TextInputGroup style={{ width: "300px" }} isDisabled={props.disabled}>
- <TextInputGroupMain
- id="search-input"
- value={search}
- placeholder='Search'
- type="text"
- autoComplete={"off"}
- autoFocus={true}
- onChange={(_event, value) => {
- setSearch(value);
- }}
- aria-label="text input example"
- />
- <TextInputGroupUtilities>
- <Button variant="plain" onClick={_ => {
- setSearch('');
- }}>
- <TimesIcon aria-hidden={true}/>
- </Button>
- </TextInputGroupUtilities>
- </TextInputGroup>
- )
- }
-
- return (searchInput())
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/ImageDownloadToolbar.tsx b/karavan-app/src/main/webui/src/karavan/features/project/ImageDownloadToolbar.tsx
deleted file mode 100644
index 8cfcf79a..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/ImageDownloadToolbar.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import React, {useEffect} from 'react';
-import {FlexItem, Toolbar, ToolbarContent,} from '@patternfly/react-core';
-import '@features/project/designer/karavan.css';
-
-import {CamelDefinitionYaml} from "@karavan-core/api/CamelDefinitionYaml";
-import {useFileStore, useProjectStore} from "../../stores/ProjectStore";
-import {EventBus} from "@features/project/designer/utils/EventBus";
-import {shallow} from "zustand/shallow";
-
-export function ImageDownloadToolbar() {
-
- const [project] = useProjectStore((s) => [s.project], shallow)
- const [file] = useFileStore((state) => [state.file], shallow)
-
- useEffect(() => {
- }, [file]);
-
- function isYaml(): boolean {
- return file !== undefined && file.name.endsWith("yaml");
- }
-
- function isIntegration(): boolean {
- return isYaml() && file?.code !== undefined && CamelDefinitionYaml.yamlIsIntegration(file.code) !== 'none';
- }
-
- function downloadImage() {
- EventBus.sendCommand("downloadImage");
- }
-
- return (
- <Toolbar id="toolbar-group-types">
- <ToolbarContent>
- {isIntegration() &&
- <FlexItem>
- {/*<Tooltip content="Download image" position={"bottom-end"}>*/}
- {/* <Button size="sm" variant="control" icon={<DownloadImageIcon/>}*/}
- {/* onClick={e => downloadImage()}/>*/}
- {/*</Tooltip>*/}
- </FlexItem>
- }
- </ToolbarContent>
- </Toolbar>
- )
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/Project.types.ts b/karavan-app/src/main/webui/src/karavan/features/project/Project.types.ts
deleted file mode 100644
index 0910166d..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/Project.types.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import {DslMetaModel} from "@features/project/designer/utils/DslMetaModel";
-import {Project} from "@models/ProjectModels";
-
-export type ProjectFunctions = {
- createNewRouteFile: (dsl: DslMetaModel, parentId: string, position?: number | undefined, fileName?: string) => void;
- createOpenApiRestFile: () => void;
- createNewBean: () => void;
- createNewKamelet: () => void;
- createRouteConfiguration: () => void;
- createOpenApi: () => void;
- createAsyncApi: () => void;
- createNewRestFile: () => void;
- refreshData: () => void;
- refreshSharedData: () => void;
- project: Project
-};
-
-// 2. Define the hook FUNCTION'S signature
-export type UseProjectHook = () => ProjectFunctions;
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/ProjectContainerContextToolbar.tsx b/karavan-app/src/main/webui/src/karavan/features/project/ProjectContainerContextToolbar.tsx
deleted file mode 100644
index edd31f6c..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/ProjectContainerContextToolbar.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-import React, {ReactElement} from 'react';
-import {ProjectTitle} from "@features/project/ProjectTitle";
-import {ProjectContainersContext} from "@features/project/ProjectContainersContextProvider";
-import {ToggleGroup, ToggleGroupItem} from "@patternfly/react-core";
-import {useProjectStore, useSelectedContainerStore} from "@stores/ProjectStore";
-import {BuildIcon, CogIcon, RunningIcon} from "@patternfly/react-icons";
-import {ContainerStatus} from "@models/ProjectModels";
-
-interface Props {
- additionalTools?: ReactElement;
- hideContainersToggle?: boolean;
-}
-
-export function ProjectContainerContextToolbar(props: Props): ReactElement {
-
- const {additionalTools, hideContainersToggle} = props;
- const context = React.useContext(ProjectContainersContext);
- // if (!context) throw new Error("ProjectContainersContext not found!");
- // const {containerStatuses} = context ? context : undefined;
- const [selectedContainerName, setSelectedContainerName] = useSelectedContainerStore((s) => [s.selectedContainerName, s.setSelectedContainerName]);
- const [tabIndex] = useProjectStore((s) => [s.tabIndex]);
-
- function getIcon(status: ContainerStatus) {
- if (status.type === "devmode") {
- const className = status.state === "running" ? 'project-container-devmode' : ''
- return <CogIcon className={className}/>
- } else if (status.type === "packaged") {
- const className = status.state === "running" ? 'project-container-package' : ''
- return <RunningIcon className={className}/>
- } else if (status.type === "build") {
- const className = status.state === "running" ? 'project-container-build' : ''
- return <BuildIcon className={className}/>
- }
- }
-
- function getContainers() {
- if (tabIndex !== 'build') {
- return context?.containerStatuses?.filter( cs => cs.type !== 'build') ?? [];
- } else {
- return context?.containerStatuses?.filter( cs => cs.type === 'build') ?? [];
- }
- }
-
- return (
- <div className="topology-toolbar">
- <div className="group-switch">
- <ProjectTitle/>
- </div>
- {additionalTools}
- {context && !hideContainersToggle && <div>
- <ToggleGroup aria-label="Default with single selectable">
- {getContainers().map(status => (
- <ToggleGroupItem
- key={status.containerName}
- icon={getIcon(status)}
- text={status.containerName}
- buttonId={status.containerName}
- isSelected={selectedContainerName === status.containerName}
- onChange={_ => setSelectedContainerName(status.containerName)}
- />
- ))}
- </ToggleGroup>
- </div>
- }
- </div>
- )
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/ProjectContainersContextProvider.tsx b/karavan-app/src/main/webui/src/karavan/features/project/ProjectContainersContextProvider.tsx
deleted file mode 100644
index 10370606..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/ProjectContainersContextProvider.tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-import React from 'react';
-import {useAppConfigStore, useProjectStore} from "@stores/ProjectStore";
-import {shallow} from "zustand/shallow";
-import {ContainerStatus} from "@models/ProjectModels";
-import {Label, Tooltip} from "@patternfly/react-core";
-import {CogIcon, PackageIcon} from "@patternfly/react-icons";
-import DevIcon from "@patternfly/react-icons/dist/esm/icons/dev-icon";
-import {useContainerStatusesStore} from "@stores/ContainerStatusesStore";
-
-type ProjectContainersContextType = {
- containerStatuses: ContainerStatus[]
- packagedContainerStatuses: ContainerStatus[]
- devModeContainerStatus?: ContainerStatus
- devModeIsRunning: boolean;
- packagedIsRunning: boolean;
- buildIsRunning: boolean;
- origin: string;
- camelContext: any,
- containersStatusIcons: React.ReactElement<any>,
-};
-
-export const ProjectContainersContext = React.createContext<ProjectContainersContextType | undefined>(undefined);
-
-type ProjectContainersContextEnvelopeProps = {
- children: React.ReactNode
-};
-
-export function ProjectContainersContextProvider({children}: ProjectContainersContextEnvelopeProps) {
-
- const [config] = useAppConfigStore((s) => [s.config], shallow);
- const [project, camelStatuses] = useProjectStore((s) => [s.project, s.camelStatuses], shallow);
- const {containers} = useContainerStatusesStore();
-
- const containerStatuses = containers.filter(c => c.projectId === project?.projectId) || [];
- const packagedContainerStatuses = containerStatuses.filter(c => c.type === 'packaged') || [];
- const isProjectContainer = packagedContainerStatuses.length > 0;
- const packagedIsRunning = isProjectContainer && (packagedContainerStatuses.filter(c => c.state === 'running').length === packagedContainerStatuses.length);
-
- const devModeContainerStatus = containerStatuses.filter(c => c.type === 'devmode').at(0);
- const devModeIsRunning = devModeContainerStatus?.state === 'running';
-
- const buildContainerStatus = containerStatuses.filter(c => c.type === 'build').at(0);
- const buildIsRunning = buildContainerStatus?.state === 'running';
-
- const isKubernetes = config.infrastructure === 'kubernetes'
-
- const runningContainer = devModeIsRunning ? devModeContainerStatus : packagedContainerStatuses.find(c => c.state === 'running');
-
- const origin = 'http://' + (isKubernetes
- ? runningContainer?.podId + ':8080'
- : runningContainer?.containerName + ':8080'
- );
-
- const camelStatus = camelStatuses.filter(s => s.projectId === project.projectId).at(0);
- const contextValue = camelStatus?.statuses?.filter(x => x.name === 'context').at(0);
- const camelContext = contextValue ? JSON.parse(contextValue?.status || '') : {};
-
- const isRunning = packagedIsRunning || devModeIsRunning;
- const className = isRunning ? 'rotated-run' : ''
- const tooltip = devModeIsRunning ? 'Running dev mode' : 'Running packaged'
- const containersStatusIcons = (
- <div style={{flex: 2, display: 'flex', flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'center'}}>
- {isRunning &&
- <Tooltip content={tooltip} position='left'>
- <Label variant='outline'>
- <div style={{display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', gap: '3px'}}>
- <CogIcon className={`${className} rotated-run-forward`}/>
- {devModeIsRunning && <DevIcon className={className} width={32} height={32}/>}
- {packagedIsRunning && <PackageIcon className={className} width={32} height={32}/>}
- </div>
- </Label>
- </Tooltip>
- }
- </div>
- )
-
- return (
- <ProjectContainersContext.Provider value={{containerStatuses, packagedContainerStatuses, devModeContainerStatus, devModeIsRunning, packagedIsRunning, origin, buildIsRunning, camelContext, containersStatusIcons}}>
- {children}
- </ProjectContainersContext.Provider>
- );
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/ProjectContext.tsx b/karavan-app/src/main/webui/src/karavan/features/project/ProjectContext.tsx
deleted file mode 100644
index 830f672d..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/ProjectContext.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import React, {createContext, useContext} from 'react';
-import {ProjectFunctions, UseProjectHook} from './Project.types';
-
-const ProjectContext = createContext<ProjectFunctions | null>(null);
-
-export const useProjectFunctions = () => {
- const context = useContext(ProjectContext);
- if (context === null) {
- throw new Error('UseProjectHook must be used within a ProjectProvider');
- }
- return context;
-};
-
-interface ProjectProviderProps {
- children: React.ReactNode;
- useProjectHook: UseProjectHook;
-}
-
-export const ProjectProvider: React.FC<ProjectProviderProps> = ({
- children,
- useProjectHook,
- }) => {
- const api = useProjectHook();
- return (
- <ProjectContext.Provider value={api}>
- {children}
- </ProjectContext.Provider>
- );
-};
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/ProjectPage.css b/karavan-app/src/main/webui/src/karavan/features/project/ProjectPage.css
deleted file mode 100644
index 73fdc068..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/ProjectPage.css
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-.karavan .project-page {
- display: flex;
- flex-direction: column;
- height: 100%;
-}
-
-.karavan .project-page .scrollable-out {
- display: flex;
- flex-direction: column;
- height: 100%;
-}
-
-.karavan .project-page .scrollable-in {
- overflow: auto;
- flex-shrink: unset;
- flex-grow: 1;
- margin-bottom: 100px;
-}
-
-.karavan .project-title {
- flex: 1;
- .pf-v6-l-flex.pf-m-column > * {
- margin-bottom: 0;
- }
- .pf-v6-c-clipboard-copy {
- width: fit-content;
- .pf-v6-c-button {
- padding: 0;
- }
- }
-}
-
-.karavan .project-page .tools-section {
- border-bottom: 1px solid #eee;
-}
-
-.karavan .project-page .project-tabs {
- background-color: white;
-}
-
-.karavan .project-page .description-align-center .pf-v6-c-description-list__group {
- min-height: 30px;
- align-items: center;
-}
-
-.karavan .project-page .pf-v6-c-tabs__link,
-.karavan .project-page .pf-m-link {
- font-size: 14px;
-}
-
-.karavan .project-page .project-button {
- width: 100px;
-}
-
-.karavan .project-page .badge-env-up {
- background-color: rgb(56, 129, 47);
- color: white;
-}
-
-.karavan .project-page .env-chart {
- font-size: 18px;
-}
-
-.karavan .project-page .replicas-ready {
- background-color: rgb(56, 129, 47);
- color: white;
-}
-
-.karavan .project-page .health-up {
- background-color: rgb(56, 129, 47);
- color: white;
-}
-
-.karavan .project-page .project-properties .delete-cell {
- padding: 0;
- margin: 0;
- min-width: 0;
-}
-.karavan .project-page .project-properties .delete-button {
- padding: 0 0 0 0;
- margin: 0 16px 0 0;
-}
-
-.karavan .project-page .pf-v6-c-label__icon {
- height: 16px;
-}
-
-.karavan .project-page .pf-v6-c-label__icon svg {
- height: 16px;
-}
-
-.karavan .project-page .badge {
- font-size: 14px;
- font-weight: 400;
- padding: 4px 8px 4px 8px;
- min-width: 70px;
-}
-
-.karavan .project-files-toolbar {
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: 8px;
- padding: 8px 16px 8px 16px;
- position: relative;
-}
-
-.karavan .project-files-toolbar::before {
- position: absolute;
- inset: 0;
- pointer-events: none;
- content: "";
- border-bottom: var(--pf-t--global--border--color--default) solid var(--pf-t--global--border--width--box--default);
- border-radius: inherit;
-}
-
-.karavan .project-page .runtime-tab {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- padding: 16px;
- gap: 16px;
-
- .runtime-element {
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 8px;
- }
-}
-
-.karavan .project-page-navigation {
- gap: 16px;
- .pf-v6-c-nav__link {
- align-items: center;
- .pf-v6-c-nav__link-icon {
- display: flex;
- align-items: center;
- /*width: 20px;*/
- /*height: 20px;*/
- }
- }
-
- .jvm-svg-steam-on {
- height: 20px;
- width: 20px;
- filter: brightness(1.3) contrast(1.3) saturate(2) drop-shadow(0 0 6px #4cc3ff);
- .steam {
- fill: #FF8C26;
- transform-origin: center;
- animation: steam-movement 4s infinite, /* Combined scale and translate */ steam-opacity 4s infinite; /* Opacity */
- }
- }
-
- .jvm-svg-steam-off {
- height: 20px;
- width: 20px;
- filter: brightness(2) saturate(0);
- animation: none !important;
- }
- .k8s {
- height: 20px;
- width: 20px;
- }
-
- .camel-paused {
- filter: saturate(0);
- }
-
- .rotated-run {
- width: 16px;
- height: 16px;
- color: var(--pf-t--color--green--40);
- /*animation: icon-flashing 1.5s linear infinite;*/
- }
- .rotated-run-forward {
- animation: rotate-icon-forward 1.5s linear infinite
- }
-
- .rotated-run-backward {
- animation: rotate-icon-backward 1.5s linear infinite,
- icon-flashing 1.5s linear infinite
- }
-
- .containers-run {
- color: var(--pf-t--global--color--status--success--100);
- animation: icon-flashing 1.5s linear infinite,
- scale-icon 1.5s linear infinite;
- }
-}
-
-@keyframes icon-flashing {
- 0% {
- color: var(--pf-t--color--green--20);
- border-color: var(--pf-t--global--color--status--success--100);
- }
- 50% {
- color: var(--pf-t--color--green--40);
- border-color: var(--pf-t--global--color--status--success--200);
- }
- 100% {
- color: var(--pf-t--color--green--60);
- border-color: var(--pf-t--global--icon--color--status--success--default);
- }
-}
-
-@keyframes scale-icon {
- from {
- transform: scale(1);
- }
- to {
- transform: scale(1.1);
- }
-}
-
-@keyframes rotate-icon-forward {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(360deg);
- }
-}
-@keyframes rotate-icon-backward {
- from {
- transform: rotate(360deg);
- }
- to {
- transform: rotate(0deg);
- }
-}
-
-@keyframes logline {
- 0% { opacity: 0; transform: translateX(-2px); }
- 20% { opacity: 1; transform: translateX(0); }
- 80% { opacity: 1; }
- 100% { opacity: 0; }
-}
-
-@keyframes steam-movement {
- 0% {
- transform: translate(0, 0) scale(1, 1);
- }
- 25% {
- transform: translate(0.5px, -1.5px) scale(1.1, 1.3);
- }
- 50% {
- transform: translate(-0.3px, -2.2px) scale(0.95, 1.1);
- }
- 75% {
- transform: translate(0.1px, -3px) scale(1.25, 1.15);
- }
- 100% {
- transform: translate(0, 0) scale(1, 1);
- }
-}
-
-@keyframes steam-opacity {
- 0% { opacity: 0.7; }
- 25% { opacity: 1; }
- 50% { opacity: 0.85; }
- 75% { opacity: 1; }
- 100% { opacity: 0.7; }
-}
-
-.popover-file-validation {
- max-width: 33%;
- .pf-v6-c-popover__content {
- padding-right: 0;
-
- .pf-v6-c-popover__body {
- max-height: 50vh;
- overflow-y: auto;
-
- .pf-v6-c-alert {
- border-width: 1px;
- padding: 6px;
- }
- }
-
- .pf-v6-c-popover__body > div {
- height: 100%; /* Make the inner div fill the body's space */
- display: flex; /* Keep original display properties for inner layout */
- flex-direction: column;
- }
- }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/ProjectPage.tsx b/karavan-app/src/main/webui/src/karavan/features/project/ProjectPage.tsx
deleted file mode 100644
index 3ccb9294..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/ProjectPage.tsx
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {JSX, useEffect, useState} from 'react';
-import './ProjectPage.css';
-import {shallow} from "zustand/shallow";
-import {useNavigate, useParams} from "react-router-dom";
-import {useFilesStore, useFileStore, useProjectsStore, useProjectStore} from '@stores/ProjectStore';
-import {BUILD_IN_PROJECTS, Project} from '@models/ProjectModels';
-import {RightPanel} from "@shared/ui/RightPanel";
-import {ROUTES} from "@app/navigation/Routes";
-import {useProjectFunctions} from './ProjectContext';
-import {ProjectPageNavigation} from "@features/project/ProjectPageNavigation";
-import {ProjectContainersContextProvider} from "@features/project/ProjectContainersContextProvider";
-import {Content} from "@patternfly/react-core";
-import {ProjectToolbar} from "@features/project/toolbar/ProjectToolbar";
-import {ProjectPanel} from "@features/project/ProjectPanel";
-import {useDataPolling} from "@shared/polling/useDataPolling";
-
-interface ProjectPageProps {
- developerManager: JSX.Element;
-}
-
-function ProjectPage(props: ProjectPageProps): JSX.Element {
-
- const {developerManager} = props;
- const [files] = useFilesStore((s) => [s.files], shallow);
- const [projects] = useProjectsStore((state) => [state.projects], shallow)
- const [project, setProject, tabIndex, setTabIndex, refreshTrace] =
- useProjectStore((s) => [s.project, s.setProject, s.tabIndex, s.setTabIndex, s.refreshTrace], shallow);
- const [file, operation, setFile] = useFileStore((s) => [s.file, s.operation, s.setFile], shallow);
- const showFilePanel = file !== undefined && operation === 'select';
- const [urlFileName, setUrlFileName] = useState<string>();
- const {refreshData} = useProjectFunctions();
-
- useDataPolling('ProjectPage', refreshData, 3000, [tabIndex, refreshTrace, project]);
-
- let {projectId, fileName} = useParams();
- const navigate = useNavigate();
-
- useEffect(() => {
- setUrlFileName(fileName)
- window.history.replaceState({}, "", `${ROUTES.PROJECTS}/${projectId}`);
- const p = projects.filter(project => project.projectId === projectId).at(0);
- if (p) {
- setProject(p, "select");
- if (!BUILD_IN_PROJECTS.includes(p.projectId)) {
- setTabIndex('topology');
- }
- } else {
- navigate('/');
- }
- return () => {
- setProject(new Project(), "none");
- setTabIndex('topology');
- }
- }, []);
-
- useEffect(() => {
- if (urlFileName !== undefined) {
- const file = files
- .filter(f => f.projectId === projectId && f.name === urlFileName)?.at(0);
- if (file) {
- setFile('select', file);
- setTabIndex('topology');
- setUrlFileName(undefined);
- }
- }
- }, [files]);
-
- function title() {
- return (<Content component="h2">Integration</Content>)
- }
-
- return (
- <RightPanel
- title={title()}
- toolsStart={
- <ProjectContainersContextProvider>
- <ProjectPageNavigation/>
- </ProjectContainersContextProvider>
- }
- tools={<ProjectToolbar/>}
- mainPanel={
- <div className="right-panel-card">
- {showFilePanel && developerManager}
- {!showFilePanel && <ProjectPanel/>}
- </div>
- }
- />
- )
-}
-
-export default ProjectPage
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/ProjectPageNavigation.tsx b/karavan-app/src/main/webui/src/karavan/features/project/ProjectPageNavigation.tsx
deleted file mode 100644
index 731b0985..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/ProjectPageNavigation.tsx
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {JSX, useEffect, useState} from 'react';
-import {capitalize, Nav, NavItem, NavList,} from '@patternfly/react-core';
-import '@features/project/ProjectPage.css';
-import {
- ProjectMenu,
- ProjectMenus,
- ProjectRuntimeMenu,
- ProjectRuntimeMenus,
- useAppConfigStore,
- useFilesStore,
- useFileStore,
- useProjectStore,
- useSelectedContainerStore
-} from '@stores/ProjectStore';
-import {BUILD_IN_PROJECTS} from '@models/ProjectModels';
-import {ProjectContainersContext} from "@features/project/ProjectContainersContextProvider";
-import {SvgIcon} from "@shared/icons/SvgIcon";
-import BuildIcon from "@patternfly/react-icons/dist/esm/icons/build-icon";
-import {shallow} from "zustand/shallow";
-import {useIntegrationStore} from "@features/project/designer/DesignerStore";
-import {KubernetesIcon} from "@features/project/designer/icons/ComponentIcons";
-
-export function ProjectPageNavigation(): JSX.Element {
-
- const [config] = useAppConfigStore((s) => [s.config], shallow);
- const isKubernetes = config.infrastructure === 'kubernetes'
- const context = React.useContext(ProjectContainersContext);
- if (!context) throw new Error("ProjectContainersContext not found!");
-
- const [selectedContainerName, setSelectedContainerName] = useSelectedContainerStore((s) => [s.selectedContainerName, s.setSelectedContainerName]);
-
- const {devModeIsRunning, packagedIsRunning, buildIsRunning, containerStatuses, devModeContainerStatus, camelContext, containersStatusIcons} = context;
- const hasContainers = containerStatuses?.length > 0;
- const devContainer = containerStatuses.filter(c => c.type === 'devmode')?.at(0)
- const hasDevmodeContainers = devContainer !== undefined;
- const buildContainer = containerStatuses.filter(c => c.type === 'build')?.at(0)
- const hasBuildContainers = buildContainer !== undefined;
-
- const [files] = useFilesStore((s) => [s.files]);
- const [project, tabIndex, setTabIndex] = useProjectStore((s) => [s.project, s.tabIndex, s.setTabIndex]);
- const [setFile, file] = useFileStore((s) => [s.setFile, s.file]);
- const [integration] = useIntegrationStore((s) => [s.integration], shallow)
-
- const [buildContainerId, setBuildContainerId] = useState<string>('');
- const [hasDevMode, setHasDevMode] = useState<boolean>(false);
-
- useEffect(() => {
- selectName();
- }, [tabIndex, hasDevmodeContainers, hasBuildContainers, buildContainer?.containerId, buildContainerId])
-
- function selectName() {
- const selectedContainers = containerStatuses.filter(c => c.containerName === selectedContainerName) || [];
- const names = containerStatuses
- ?.filter(cs => {
- if (tabIndex === "build") {
- return cs.type === 'build'
- } else {
- return ['devmode', 'packaged'].includes(cs.type)
- }
- })
- ?.map(cs => cs.containerName);
- const name = names?.at(0);
- if (tabIndex === "build" && buildContainer?.containerId && buildContainerId !== buildContainer?.containerId) {
- setSelectedContainerName(undefined);
- setBuildContainerId(buildContainer?.containerId);
- } else if (tabIndex === "build" && buildContainerId === buildContainer?.containerId && selectedContainerName === undefined) {
- setSelectedContainerName(buildContainer.containerName);
- } else if (!hasDevmodeContainers && hasDevMode) {
- setHasDevMode(false);
- setTabIndex(0);
- setSelectedContainerName(undefined);
- } else if (hasDevmodeContainers && !hasDevMode) {
- setHasDevMode(true);
- setTabIndex('log');
- setSelectedContainerName(devModeContainerStatus?.containerName);
- } else if (selectedContainers.length === 0 && selectedContainerName !== undefined) {
- setSelectedContainerName(undefined);
- } else if (selectedContainerName === undefined || !names?.includes(selectedContainerName) && name) {
- setSelectedContainerName(name);
- } else if (!names?.includes(selectedContainerName)) {
- setSelectedContainerName(undefined);
- }
- }
-
- function isBuildIn(): boolean {
- return BUILD_IN_PROJECTS.includes(project?.projectId);
- }
-
- function hasReadme(): boolean {
- return files.map(f => f.name).findIndex(f => f.toLowerCase() === 'readme.md') !== -1;
- }
-
- const onNavSelect = (_: any, selectedItem: {
- groupId: number | string;
- itemId: number | string;
- to: string;
- }
- ) => {
- setTabIndex(selectedItem.itemId as ProjectMenu);
- setFile('none', undefined);
- };
-
- function getProjectMenu(): ProjectMenu[] {
- let menu: ProjectMenu[] = []
- if (isBuildIn()) {
- menu.push('source');
- } else {
- menu.push(...ProjectMenus);
- }
- if (!hasReadme()) {
- menu = menu.filter(m => m !== 'readme')
- }
- return menu;
- }
-
- function getProjectRuntimeMenusMenu(): ProjectRuntimeMenu[] {
- const menus = isKubernetes ? ProjectRuntimeMenus : ProjectRuntimeMenus.filter(m => m !== 'pod');
- let menu: (ProjectRuntimeMenu)[] = []
- if ((devModeIsRunning || packagedIsRunning || devModeContainerStatus) && tabIndex !== "build") {
- menu.push(...menus);
- }
- return menu;
- }
-
- function getIcon(item: ProjectRuntimeMenu | ProjectMenu) {
- const isRunning = packagedIsRunning || devModeIsRunning;
- if (item === 'log') {
- const className = isRunning ? 'log-on' : 'log-off'
- return <SvgIcon icon='log' className={className}/>
- } else if (item === 'build' && hasBuildContainers) {
- const className = buildIsRunning ? 'containers-run' : ''
- return <BuildIcon className={className}/>
- } else if (item === 'pod') {
- return KubernetesIcon("k8s")
- }
- }
-
- const projectRuntimeMenus = getProjectRuntimeMenusMenu();
- return (
- <Nav onSelect={onNavSelect} aria-label="Nav1" variant="horizontal" className="project-page-navigation">
- <NavList>
- {getProjectMenu().map((item, i) =>
- <NavItem icon={getIcon(item)} key={item} preventDefault itemId={item} isActive={tabIndex === item} to="#">
- {capitalize(item)}
- </NavItem>
- )}
- </NavList>
- {containersStatusIcons}
- {projectRuntimeMenus.length > 0 &&
- <NavList>
- {getProjectRuntimeMenusMenu().map((item, i) => {
- return (
- <NavItem icon={getIcon(item)} key={item} preventDefault itemId={item} isActive={tabIndex === item} to="#">
- {capitalize(item)}
- </NavItem>
- )
- }
- )}
- </NavList>
- }
- </Nav>
- )
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/ProjectPanel.tsx b/karavan-app/src/main/webui/src/karavan/features/project/ProjectPanel.tsx
deleted file mode 100644
index df2e0954..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/ProjectPanel.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect, useState} from 'react';
-import {shallow} from "zustand/shallow";
-import {useFilesStore, useProjectStore} from '@stores/ProjectStore';
-import {useSelectorStore} from '@features/project/designer/DesignerStore';
-import {ProjectService} from '@services/ProjectService';
-import {BUILD_IN_PROJECTS, ProjectType} from '@models/ProjectModels';
-import {TopologyTab} from '@features/project/project-topology/TopologyTab';
-import {CreateProjectModal} from '@features/project/files/CreateProjectModal';
-import {DslSelector} from '@features/project/designer/selector/DslSelector';
-import {BeanWizard} from '@features/project/beans/BeanWizard';
-import {BuildTab} from '@features/project/project-build/BuildTab';
-import {ReadmeTab} from "@features/project/readme/ReadmeTab";
-import {SourcesTab} from '@features/project/files/SourcesTab';
-import {useProjectFunctions} from "@features/project/ProjectContext";
-import {ContainerLogTab} from "@features/project/ContainerLogTab";
-import {ProjectContainersContextProvider} from "@features/project/ProjectContainersContextProvider";
-import {ContainersTab} from "@features/project/project-containers/ContainersTab";
-import {PodTab} from "@features/project/project-pod/PodTab";
-
-export function ProjectPanel() {
-
- const [project, tab, setTabIndex] = useProjectStore((s) => [s.project, s.tabIndex, s.setTabIndex], shallow);
- const [setFiles, setSelectedFileNames] = useFilesStore((s) => [s.setFiles, s.setSelectedFileNames], shallow);
- const [showSelector] = useSelectorStore((s) => [s.showSelector], shallow)
- const [asyncApiJson] = useState<string>('');
-
- const {createNewRouteFile, refreshSharedData} = useProjectFunctions();
-
- useEffect(() => {
- onRefresh();
- }, [project]);
-
- function onRefresh() {
- if (project?.projectId) {
- setFiles([]);
- setSelectedFileNames([]);
- ProjectService.refreshProjectData(project.projectId);
- setTabIndex(project.type !== ProjectType.integration ? 'source' : tab);
- refreshSharedData();
- }
- }
-
- function isBuildIn(): boolean {
- return BUILD_IN_PROJECTS.includes(project.projectId);
- }
-
- const buildIn = isBuildIn();
- const isTopology = tab === 'topology';
-
- return isTopology
- ? (<>
- <TopologyTab asyncApiJson={asyncApiJson}/>
- <CreateProjectModal/>
- {showSelector && <DslSelector onDslSelect={createNewRouteFile} showFileNameInput={true}/>}
- <BeanWizard/>
- </>
- )
- : (
- <div style={{display: 'flex', flexDirection: 'column', height: '100%'}}>
- {tab === 'source' && <SourcesTab/>}
- {!buildIn && tab === "build" && <BuildTab/>}
- {/*{!buildIn && tab === "build" && config.infrastructure !== 'kubernetes' && <ImagesPanel/>}*/}
- {!buildIn && tab === 'readme' && <ReadmeTab/>}
- {!buildIn && tab === 'pod' && <ProjectContainersContextProvider><PodTab/></ProjectContainersContextProvider>}
- {!buildIn && tab === 'log' && <ProjectContainersContextProvider><ContainerLogTab/></ProjectContainersContextProvider>}
- {!buildIn && tab === 'containers' && <ProjectContainersContextProvider><ContainersTab/></ProjectContainersContextProvider>}
- </div>
- )
-}
-
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/ProjectTitle.tsx b/karavan-app/src/main/webui/src/karavan/features/project/ProjectTitle.tsx
deleted file mode 100644
index 0d8ad297..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/ProjectTitle.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import React from 'react';
-import {ClipboardCopy, Content, Flex, FlexItem,} from '@patternfly/react-core';
-import {useFileStore, useProjectStore} from "@stores/ProjectStore";
-import {shallow} from "zustand/shallow";
-
-export function ProjectTitle() {
-
- const [project, tabIndex, setTabIndex] = useProjectStore((s) => [s.project, s.tabIndex, s.setTabIndex], shallow);
- const [file, setFile, operation] = useFileStore((s) => [s.file, s.setFile, s.operation], shallow);
-
- const isFile = file !== undefined && operation !== 'delete';
- const isLog = file !== undefined && file.name.endsWith("log");
- const filename = file ? file.name.substring(0, file.name.lastIndexOf('.')) : "";
-
- function getProjectTitle() {
- return (
- <Flex direction={{default: "column"}} gap={{default: 'gapNone'}}>
- <FlexItem>
- <Content component="h3">{project?.name}</Content>
- </FlexItem>
- <FlexItem>
- <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">
- {project?.projectId}
- </ClipboardCopy>
- </FlexItem>
- </Flex>
- )
- }
-
- function getFileTitle() {
- return (isFile ?
- <Flex direction={{default: "column"}} gap={{default: 'gapNone'}}>
- <FlexItem>
- <Content component="h3">{project?.name}</Content>
- </FlexItem>
- <FlexItem>
- <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">
- {isLog ? filename : file.name}
- </ClipboardCopy>
- </FlexItem>
- </Flex>
- : <></>
- )
- }
-
- return (
- <div className="dsl-title project-title">
- {isFile && getFileTitle()}
- {!isFile && getProjectTitle()}
- </div>
- )
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/RenameFileModal.tsx b/karavan-app/src/main/webui/src/karavan/features/project/RenameFileModal.tsx
deleted file mode 100644
index 8aec9807..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/RenameFileModal.tsx
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import React, {useEffect} from 'react';
-import {Button, Form, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant} from '@patternfly/react-core';
-import {useFileStore, useProjectStore} from "@stores/ProjectStore";
-import {RESERVED_WORDS} from "@models/ProjectModels";
-import {shallow} from "zustand/shallow";
-import {SubmitHandler, useForm} from "react-hook-form";
-import {EventBus} from "@features/project/designer/utils/EventBus";
-import {isValidFileName} from "@util/StringUtils";
-import {useFormUtil} from "@util/useFormUtil";
-import {KaravanApi} from "@api/KaravanApi";
-
-type FormValues = {
- newName: string;
-};
-
-interface RenameFileModalProps {
- show: boolean,
- onRename: () => void
- onClose: () => void
-}
-
-export function RenameFileModal({show, onClose, onRename}: RenameFileModalProps) {
-
- const [project] = useProjectStore((s) => [s.project], shallow);
- const [file] = useFileStore((s) => [s.file], shallow);
- const formContext = useForm<FormValues>({
- mode: "onChange",
- defaultValues: { newName: file?.name },
- });
- const {getTextField} = useFormUtil(formContext);
- const {
- register,
- handleSubmit,
- formState: { errors, isSubmitting },
- reset,
- } = formContext;
-
- useEffect(() => {
- reset({ newName: file?.name || "" });
- }, [file, reset]);
-
- function closeModal() {
- onClose();
- }
-
- const onSubmit: SubmitHandler<FormValues> = (data) => {
- if (file) {
- KaravanApi.renameProjectFile(project.projectId, file?.name, data.newName, (result: boolean, err?: Error | undefined) => {
- if (result) {
- onRename();
- } else {
- EventBus.sendAlert("Error", err?.message ?? "Error copying file!", "warning");
- }
- })
- }
- }
-
- function onKeyDown(event: React.KeyboardEvent<HTMLDivElement>): void {
- if (event.key === 'Enter') {
- event.preventDefault();
- event.stopPropagation();
- handleSubmit(onSubmit)();
- }
- }
-
- return (
- <Modal
- variant={ModalVariant.small}
- isOpen={show}
- onClose={closeModal}
- onKeyDown={onKeyDown}
- >
- <ModalHeader title='Rename file'/>
- <ModalBody>
- <Form autoComplete="off" isHorizontal className="create-file-form">
- {getTextField('newName', 'Name', {
- regex: v => isValidFileName(v) || 'Not a valid filename',
- length: v => v.length > 5 || 'File name should be longer that 5 characters',
- name: v => !(RESERVED_WORDS.concat(file?.name ?? '')).includes(v) || "Reserved word",
- })}
- </Form>
- </ModalBody>
- <ModalFooter>
- <Button key="confirm" variant="primary" onClick={handleSubmit(onSubmit)}
- isDisabled={Object.getOwnPropertyNames(errors).length > 0}
- >
- Save
- </Button>
- <Button key="cancel" variant="secondary" onClick={closeModal}>Cancel</Button>
- </ModalFooter>
- </Modal>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/beans/BeanFilesDropdown.tsx b/karavan-app/src/main/webui/src/karavan/features/project/beans/BeanFilesDropdown.tsx
deleted file mode 100644
index 11abdffe..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/beans/BeanFilesDropdown.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useState} from 'react';
-import {Dropdown, DropdownItem, DropdownList, MenuToggle, MenuToggleElement} from '@patternfly/react-core';
-import {shallow} from "zustand/shallow";
-import EllipsisVIcon from "@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon";
-import {useFilesStore} from "@stores/ProjectStore";
-
-const CAMEL_YAML_EXT = ".camel.yaml";
-
-interface Props {
- onSelect: (filename: string, event?: React.MouseEvent<Element, MouseEvent>) => void;
-}
-
-export function BeanFilesDropdown(props: Props) {
-
- const [files] = useFilesStore((s) => [s.files], shallow);
- const [isOpenDropdown, setIsOpenDropdown] = useState<boolean>(false);
-
- function onMenuToggleClick() {
- setIsOpenDropdown(!isOpenDropdown)
- }
-
- function getToggle(toggleRef: React.Ref<MenuToggleElement>) {
- return (
- <MenuToggle className="bean-wizard-toggle"
- id={'popoverId'}
- ref={toggleRef}
- aria-label="placeholder menu"
- variant="default"
- onClick={() => onMenuToggleClick()}
- isExpanded={isOpenDropdown}
- >
- <EllipsisVIcon/>
- </MenuToggle>
- )
- }
-
- const camelYamlFiles = files.filter(f => f.name.endsWith(CAMEL_YAML_EXT)).map(f => f.name);
-
- return (
- (files && files.length > 0 ) ?
- <Dropdown
- popperProps={{position: "end"}}
- isOpen={isOpenDropdown}
- onSelect={(e, value) => {
- if (value) {
- props.onSelect(value?.toString().replace(CAMEL_YAML_EXT, ''), e);
- }
- setIsOpenDropdown(false);
- }}
- onOpenChange={(isOpen: boolean) => setIsOpenDropdown(isOpen)}
- toggle={(toggleRef: React.Ref<MenuToggleElement>) => getToggle(toggleRef)}
- shouldFocusToggleOnSelect
- >
- <DropdownList>
- {camelYamlFiles.map((pp, index) =>
- <DropdownItem value={pp} key={index}>{pp}</DropdownItem>
- )}
- </DropdownList>
- </Dropdown>
- : <></>
- )
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/beans/BeanWizard.tsx b/karavan-app/src/main/webui/src/karavan/features/project/beans/BeanWizard.tsx
deleted file mode 100644
index 39728a00..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/beans/BeanWizard.tsx
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect, useMemo, useState} from 'react';
-import {
- Alert,
- capitalize,
- Content,
- Flex,
- Form,
- FormAlert,
- FormGroup,
- InputGroup,
- InputGroupItem,
- Modal,
- ModalBody,
- ModalHeader,
- ModalVariant,
- Radio,
- TextInput,
- Wizard,
- WizardStep
-} from '@patternfly/react-core';
-import {BeanFactoryDefinition} from "@karavan-core/model/CamelDefinition";
-import {CodeUtils} from "@util/CodeUtils";
-import {ProjectFile} from "@models/ProjectModels";
-import {useFilesStore, useFileStore, useProjectStore, useWizardStore} from "@stores/ProjectStore";
-import {shallow} from "zustand/shallow";
-import {ProjectService} from "@services/ProjectService";
-import {EventBus} from "@features/project/designer/utils/EventBus";
-import {Integration} from "@karavan-core/model/IntegrationDefinition";
-import {CamelDefinitionYaml} from "@karavan-core/api/CamelDefinitionYaml";
-import {BeanFilesDropdown} from "./BeanFilesDropdown";
-import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
-import {useTemplatesStore} from "@stores/SettingsStore";
-import {KaravanApi} from "@api/KaravanApi";
-import {KARAVAN_DOT_EXTENSION, WIZARD_BEAN_TEMPLATE_FILENAME_PREFIX} from "@karavan-core/contants";
-
-const EMPTY_BEAN = "empty";
-
-export function BeanWizard() {
-
- const [project] = useProjectStore((s) => [s.project], shallow);
- const [setFile, designerTab] = useFileStore((s) => [s.setFile, s.designerTab], shallow);
- const [files] = useFilesStore((s) => [s.files], shallow);
- const [showWizard, setShowWizard] = useWizardStore((s) => [s.showWizard, s.setShowWizard], shallow)
- const [templateNames, setTemplateNames] = useState<string[]>([]);
- const [templateName, setTemplateName] = useState<string>('');
- const [templateBeanName, setTemplateBeanName] = useState<string>('');
- const [bean, setBean] = useState<BeanFactoryDefinition | undefined>();
- const [filename, setFilename] = useState<string>('');
- const [backendError, setBackendError] = React.useState<string>();
-
- const templateFiles = useTemplatesStore(s => s.templateFiles);
- const fetchTemplateFiles = useTemplatesStore(s => s.fetchTemplateFiles);
-
-
- useEffect(() => {
- if (showWizard) {
- setBackendError(undefined);
- setFilename('')
- setTemplateName('');
- setTemplateBeanName('');
- setBean(undefined);
- fetchTemplateFiles();
- }
- }, [showWizard]);
-
- useEffect(() => {
- const templateNames = templateFiles.filter(f => f.name.startsWith(WIZARD_BEAN_TEMPLATE_FILENAME_PREFIX))
- .map(file => file.name.replace(WIZARD_BEAN_TEMPLATE_FILENAME_PREFIX, '').replace(KARAVAN_DOT_EXTENSION.CAMEL_YAML, ''));
- setTemplateNames([...templateNames]);
- }, [templateFiles]);
-
- useEffect(() => {
- getBeans.filter(b => b.name === templateBeanName).forEach(b => {
- setBean(new BeanFactoryDefinition({...b}))
- });
- }, [templateBeanName]);
-
-
- function handleOnFormSubmitSuccess(file: ProjectFile) {
- const message = "File successfully created.";
- EventBus.sendAlert("Success", message, "success");
- ProjectService.refreshProjectData(file.projectId);
- setFile('select', file, designerTab);
- setShowWizard(false);
- }
-
- function handleFormSubmit() {
- const file = files.filter(f=> f.name === (filename + KARAVAN_DOT_EXTENSION.CAMEL_YAML)).at(0);
- if (file && bean !== undefined) {
- const i = CamelDefinitionYaml.yamlToIntegration(file.name, file.code);
- const i2 = CamelDefinitionApiExt.addBeanToIntegration(i, bean);
- const file2 = {...file} as ProjectFile;
- file2.code = CamelDefinitionYaml.integrationToYaml(i2);
- ProjectService.updateFile(file2, false);
- handleOnFormSubmitSuccess(file2);
- } else {
- let code = '{}';
- if (bean !== undefined && templateName !== EMPTY_BEAN) {
- const i = Integration.createNew("temp");
- const i2 = CamelDefinitionApiExt.addBeanToIntegration(i, bean);
- code = CamelDefinitionYaml.integrationToYaml(i2);
- }
- const fullFileName = filename + KARAVAN_DOT_EXTENSION.CAMEL_YAML;
- const file = new ProjectFile(fullFileName, project.projectId, code, Date.now());
- KaravanApi.saveProjectFile(file, (result, file) => {
- if (result) {
- handleOnFormSubmitSuccess(file);
- } else {
- setBackendError(file?.response?.data);
- }
- })
- }
- }
-
- function getBeanFactoryDefinitions(): BeanFactoryDefinition[] {
- const fs = templateFiles.filter(f => f.name === WIZARD_BEAN_TEMPLATE_FILENAME_PREFIX.concat(templateName).concat(KARAVAN_DOT_EXTENSION.CAMEL_YAML));
- return CodeUtils.getBeans(fs);
- }
-
- const getBeans = useMemo(() => getBeanFactoryDefinitions(), [templateName]);
-
- return (
- <Modal onClose={_ => setShowWizard(false)}
- variant={ModalVariant.medium} isOpen={showWizard} onEscapePress={() => setShowWizard(false)}>
- <ModalHeader title="Bean Wizard"/>
- <ModalBody>
- <Wizard className="bean-wizard" height={600} onClose={() => setShowWizard(false)} onSubmit={event => handleFormSubmit()}>
- <WizardStep name={"Type"} id="type"
- footer={{isNextDisabled: !templateNames.includes(templateName) && templateName !== EMPTY_BEAN}}
- >
- <Flex direction={{default: "column"}} gap={{default: 'gapLg'}}>
- <Radio key={EMPTY_BEAN} id={EMPTY_BEAN} label={capitalize(EMPTY_BEAN)} name={EMPTY_BEAN}
- isChecked={EMPTY_BEAN === templateName} onChange={_ => setTemplateName(EMPTY_BEAN)}/>
- {templateNames.map(n => <Radio key={n} id={n} label={capitalize(n)} name={n}
- isChecked={n === templateName}
- onChange={_ => setTemplateName(n)}/>)}
- </Flex>
- </WizardStep>
- <WizardStep name={"Template"} id="template"
- isHidden={templateName === EMPTY_BEAN}
- isDisabled={templateName.length === 0}
- footer={{isNextDisabled: !getBeans.map(b => b.name).includes(templateBeanName)}}
- >
- <Flex direction={{default: "column"}} gap={{default: 'gapLg'}}>
- {getBeans.map(b => <Radio key={b.name} id={b.name} label={b.name} name={b.name}
- isChecked={b.name === templateBeanName}
- onChange={_ => setTemplateBeanName(b.name)}/>)}
- </Flex>
- </WizardStep>
- <WizardStep name="Properties" id="properties"
- isHidden={templateName === EMPTY_BEAN}
- isDisabled={templateName.length == 0 || templateBeanName.length == 0}
- >
- <Form autoComplete="off">
- <FormGroup key={"beanName"} label={"Name"} fieldId={"beanName"}>
- <TextInput
- value={bean?.name}
- id={"beanName"}
- aria-describedby={'beanName'}
- onChange={(_, value) => {
- const b = new BeanFactoryDefinition({...bean});
- b.name = value;
- setBean(b);
- }}
- />
- </FormGroup>
- <FormGroup label="Properties:" fieldId="properties"/>
- {getBeans.filter(b => b.name === templateBeanName).map(b => (
- <div key={b.name}>
- {Object.getOwnPropertyNames(b.properties).map(prop => (
- <FormGroup key={prop} label={prop} fieldId={prop}>
- <TextInput
- value={bean?.properties[prop] || ''}
- id={prop}
- aria-describedby={prop}
- onChange={(_, value) => {
- const b = new BeanFactoryDefinition({...bean});
- b.properties[prop] = value;
- setBean(b);
- }}
- />
- </FormGroup>
- ))}
- </div>
- ))}
- </Form>
- </WizardStep>
- <WizardStep name={"File"} id={"file"}
- footer={{nextButtonText: 'Save', onNext: event => handleFormSubmit()}}
- isDisabled={(templateName.length === 0 || templateBeanName.length === 0) && templateName !== EMPTY_BEAN}
- >
- <Form autoComplete="off">
- <FormGroup label="Filename" fieldId="filename" isRequired>
- <InputGroup>
- <InputGroupItem isFill>
- <TextInput className="text-field" type="text" id="filename"
- aria-label="filename"
- value={filename}
- customIcon={<Content component="p">{KARAVAN_DOT_EXTENSION.CAMEL_YAML}</Content>}
- onChange={(e, value) => {
- setFilename(value);
- }}
- />
- </InputGroupItem>
- {templateName !== EMPTY_BEAN && <InputGroupItem>
- <BeanFilesDropdown
- onSelect={(fn, event) => {
- setFilename(fn);
- }}
- />
- </InputGroupItem>}
- </InputGroup>
- {backendError &&
- <FormAlert>
- <Alert variant="danger" title={backendError} aria-live="polite" isInline/>
- </FormAlert>
- }
- </FormGroup>
- </Form>
- </WizardStep>
- </Wizard>
- </ModalBody>
- </Modal>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/designer/CodeStore.ts b/karavan-app/src/main/webui/src/karavan/features/project/designer/CodeStore.ts
deleted file mode 100644
index 78e88133..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/designer/CodeStore.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import {createWithEqualityFn} from "zustand/traditional";
-import {shallow} from "zustand/shallow";
-
-interface CodeState {
- code: string;
- setCode: (code: string) => void;
-}
-
-export const useCodeStore = createWithEqualityFn<CodeState>((set) => ({
- code: '',
- setCode: (code: string) => {
- set({code: code});
- },
-}), shallow)
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/designer/DesignerStore.ts b/karavan-app/src/main/webui/src/karavan/features/project/designer/DesignerStore.ts
deleted file mode 100644
index 335a4bc5..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/designer/DesignerStore.ts
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {CamelElement, Integration, IntegrationFile} from "@karavan-core/model/IntegrationDefinition";
-import {DslPosition, EventBus} from "./utils/EventBus";
-import {createWithEqualityFn} from "zustand/traditional";
-import {shallow} from "zustand/shallow";
-import {BeanFactoryDefinition} from "@karavan-core/model/CamelDefinition";
-import {DslMetaModel} from "@features/project/designer/utils/DslMetaModel";
-
-interface IntegrationState {
- integration: Integration;
- json: string;
- setIntegration: (integration: Integration, propertyOnly: boolean) => void;
- propertyOnly: boolean;
- reset: () => void;
- files: IntegrationFile []
- setFiles: (files: IntegrationFile []) => void
- resetFiles: (files: IntegrationFile []) => void
- variables: string[],
- setVariables: (variables: string[]) => void;
- key: string;
- setKey: (key: string) => void;
-}
-
-export const useIntegrationStore = createWithEqualityFn<IntegrationState>((set, get) => ({
- integration: Integration.createNew("demo", "plain"),
- propertyOnly: false,
- json: '{}',
- key: '',
- setIntegration: (integration: Integration, propertyOnly: boolean) => {
- set((state: IntegrationState) => {
- const json = JSON.stringify(integration);
- if (state.json === json) {
- return {integration: state.integration, propertyOnly: state.propertyOnly, json: state.json};
- } else {
- EventBus.sendIntegrationUpdate(integration, propertyOnly);
- return {integration: integration, propertyOnly: propertyOnly, json: json};
- }
- })
- },
- reset: () => {
- set({integration: Integration.createNew("demo", "plain"), json: '{}', propertyOnly: false});
- },
- files: [],
- setFiles: (files: IntegrationFile []) => {
- set((state: IntegrationState) => {
- return {files: files};
- });
- },
- resetFiles: (files: IntegrationFile []) => {
- set((state: IntegrationState) => {
- return {files: [...files]};
- });
- },
- variables: [],
- setVariables: (variables: string[]) => {
- set((state: IntegrationState) => {
- return {variables: [...variables]};
- })
- },
- setKey: (key: string) => {
- set({key: key});
- },
-}), shallow)
-
-
-interface SelectorStateState {
- showSelector: boolean;
- setShowSelector: (showSelector: boolean) => void;
- showProperties: boolean;
- setShowProperties: (showProperties: boolean) => void;
- selectedDsl?: DslMetaModel;
- setSelectedDsl: (selectedDsl?: DslMetaModel) => void;
- showSteps: boolean;
- setShowSteps: (showSteps: boolean) => void;
- parentDsl?: string;
- setParentDsl: (parentDsl?: string) => void;
- parentId: string;
- setParentId: (parentId: string) => void;
- selectorTabIndex?: string | number
- setSelectorTabIndex: (selectorTabIndex?: string | number) => void;
- selectedPosition?: number;
- setSelectedPosition: (selectedPosition?: number) => void;
- selectedToggles: string [];
- addSelectedToggle: (label: string) => void;
- deleteSelectedToggle: (label: string) => void;
- routeId?: string;
- setRouteId: (routeId: string) => void;
- isRouteTemplate?: boolean;
- setIsRouteTemplate: (isRouteTemplate: boolean) => void;
-}
-
-export const useSelectorStore = createWithEqualityFn<SelectorStateState>((set) => ({
- showSelector: false,
- showProperties: false,
- deleteMessage: '',
- parentId: '',
- showSteps: true,
- isRouteTemplate: false,
- selectedToggles: ['eip', 'components', 'kamelets'],
- addSelectedToggle: (toggle: string) => {
- set(state => ({
- selectedToggles: [...state.selectedToggles, toggle]
- }))
- },
- deleteSelectedToggle: (toggle: string) => {
- set(state => ({
- selectedToggles: [...state.selectedToggles.filter(x => x !== toggle)]
- }))
- },
- setSelectorTabIndex: (selectorTabIndex?: string | number) => {
- set({selectorTabIndex: selectorTabIndex})
- },
- setParentDsl: (parentDsl?: string) => {
- set({parentDsl: parentDsl})
- },
- setSelectedDsl: (selectedDsl?: DslMetaModel) => {
- set(state => ({
- selectedDsl: selectedDsl,
- showProperties: selectedDsl ? state.showProperties : false
- }))
- },
- setShowSelector: (showSelector: boolean) => {
- set({showSelector: showSelector})
- },
- setShowProperties: (showProperties: boolean) => {
- set({showProperties: showProperties})
- },
- setShowSteps: (showSteps: boolean) => {
- set({showSteps: showSteps})
- },
- setParentId: (parentId: string) => {
- set({parentId: parentId})
- },
- setSelectedPosition: (selectedPosition?: number) => {
- set({selectedPosition: selectedPosition})
- },
- setRouteId: (routeId: string) => {
- set({routeId: routeId})
- },
- setIsRouteTemplate: (isRouteTemplate: boolean) => {
- set({isRouteTemplate: isRouteTemplate})
- },
-}), shallow)
-
-
-interface ConnectionsState {
- steps: Map<string, DslPosition>;
- addStep: (uuid: string, position: DslPosition) => void;
- deleteStep: (uuid: string) => void;
- clearSteps: () => void;
- setSteps: (steps: Map<string, DslPosition>) => void;
-}
-
-export const useConnectionsStore = createWithEqualityFn<ConnectionsState>((set) => ({
- steps: new Map<string, DslPosition>(),
- addStep: (uuid: string, position: DslPosition) => {
- set(state => ({
- steps: new Map(state.steps).set(uuid, position),
- }))
- },
- deleteStep: (uuid: string) => {
- set((state: ConnectionsState) => {
- // state.steps.clear();
- Array.from(state.steps.entries())
- .filter(value => value[1]?.parent?.uuid !== uuid)
- .filter(value => value[1]?.prevStep?.uuid !== uuid)
- .filter(value => value[1]?.nextstep?.uuid !== uuid)
- .forEach(value => state.steps.set(value[0], value[1]));
- state.steps.delete(uuid)
- return state;
- })
- },
- clearSteps: () => {
- set((state: ConnectionsState) => {
- state.steps.clear();
- return state;
- })
- },
- setSteps: (steps: Map<string, DslPosition>) => {
- set({steps: steps})
- }
-}), shallow)
-
-
-export const DesignerViewSwitchOptions = ["routes", "rest", "beans", "kamelet"] as const;
-export type DesignerViewSwitchOption = typeof DesignerViewSwitchOptions[number];
-
-type DesignerState = {
- designerSwitch: boolean
- isDebugging: boolean
- notificationBadge: boolean
- notificationMessage: [string, string]
- shiftKeyPressed: boolean
- showDeleteConfirmation: boolean
- showMoveConfirmation: boolean
- deleteMessage: string
- selectedStep?: CamelElement
- selectedUuids: string[]
- passedNodeIds: string[]
- passedRouteId?: string
- failedRouteId?: string
- suspendedNodeId?: string
- failed: boolean
- clipboardSteps: CamelElement[]
- width: number
- height: number
- top: number
- left: number
- moveElements: [string | undefined, string | undefined]
- propertyPlaceholders: [string, string][]
- parameterPlaceholders: [string, string][], // route template parameters
- beans: BeanFactoryDefinition[],
- tab?: DesignerViewSwitchOption,
- stepDoubleClicked: boolean,
-}
-
-const designerState: DesignerState = {
- designerSwitch: true,
- isDebugging: false,
- notificationBadge: false,
- notificationMessage: ['', ''],
- shiftKeyPressed: false,
- showDeleteConfirmation: false,
- showMoveConfirmation: false,
- deleteMessage: '',
- selectedUuids: [],
- passedNodeIds: [],
- passedRouteId: undefined,
- failedRouteId: undefined,
- suspendedNodeId: undefined,
- failed: false,
- clipboardSteps: [],
- width: 0,
- height: 0,
- top: 0,
- left: 0,
- moveElements: [undefined, undefined],
- propertyPlaceholders: [],
- parameterPlaceholders: [],
- beans: [],
- stepDoubleClicked: false,
-};
-
-type DesignerAction = {
- setDebugging: (isDebugging: boolean) => void;
- setShiftKeyPressed: (shiftKeyPressed: boolean) => void;
- setShowDeleteConfirmation: (showDeleteConfirmation: boolean) => void;
- setShowMoveConfirmation: (showMoveConfirmation: boolean) => void;
- setDeleteMessage: (deleteMessage: string) => void;
- setSelectedStep: (selectedStep?: CamelElement) => void;
- setSelectedUuids: (selectedUuids: string[]) => void;
- setPassedNodeIds: (passedNodeIds: string[]) => void;
- setPassedRouteId: (passedRouteId?: string) => void;
- setFailedRouteId: (failedRouteId?: string) => void;
- setSuspendedNodeId: (suspendedNodeId?: string) => void;
- setFailed: (failed: boolean) => void;
- setClipboardSteps: (clipboardSteps: CamelElement[]) => void;
- setPosition: (width: number, height: number, top: number, left: number) => void;
- reset: () => void;
- setNotification: (notificationBadge: boolean, notificationMessage: [string, string]) => void;
- setMoveElements: (moveElements: [string | undefined, string | undefined]) => void;
- setPropertyPlaceholders: (propertyPlaceholders: [string, string][]) => void;
- setParameterPlaceholders: (parameterPlaceholders: [string, string][]) => void;
- setBeans: (beans: BeanFactoryDefinition[]) => void;
- setTab: (tab?: DesignerViewSwitchOption) => void;
- setDesignerSwitch: (designerSwitch: boolean) => void;
- setStepDoubleClicked: (stepDoubleClicked: boolean) => void;
-}
-
-export const useDesignerStore = createWithEqualityFn<DesignerState & DesignerAction>((set) => ({
- ...designerState,
- setDebugging: (isDebugging: boolean) => {
- set({isDebugging: isDebugging})
- },
- setFailed: (failed: boolean) => {
- set({failed: failed})
- },
- setShiftKeyPressed: (shiftKeyPressed: boolean) => {
- set({shiftKeyPressed: shiftKeyPressed})
- },
- setSelectedStep: (selectedStep?: CamelElement) => {
- set({selectedStep: selectedStep})
- },
- setShowDeleteConfirmation: (showDeleteConfirmation: boolean) => {
- set({showDeleteConfirmation: showDeleteConfirmation})
- },
- setShowMoveConfirmation: (showMoveConfirmation: boolean) => {
- set({showMoveConfirmation: showMoveConfirmation})
- },
- setDeleteMessage: (deleteMessage: string) => {
- set({deleteMessage: deleteMessage})
- },
- setSelectedUuids: (selectedUuids: string[]) => {
- set((state: DesignerState) => {
- state.selectedUuids.length = 0;
- state.selectedUuids.push(...selectedUuids);
- return state;
- })
- },
- setPassedNodeIds: (passedNodeIds: string[]) => {
- set((state: DesignerState) => {
- state.passedNodeIds.length = 0;
- state.passedNodeIds.push(...passedNodeIds);
- return state;
- })
- },
- setPassedRouteId: (passedRouteId?: string) => {
- set({passedRouteId: passedRouteId})
- },
- setFailedRouteId: (failedRouteId?: string) => {
- set({failedRouteId: failedRouteId})
- },
- setSuspendedNodeId: (suspendedNodeId?: string) => {
- set({suspendedNodeId: suspendedNodeId})
- },
- setClipboardSteps: (clipboardSteps: CamelElement[]) => {
- set((state: DesignerState) => {
- state.clipboardSteps.length = 0;
- state.clipboardSteps.push(...clipboardSteps);
- return state;
- })
- },
- width: 100,
- height: 100,
- top: 0,
- left: 0,
- setPosition: (width: number, height: number, top: number, left: number) => {
- set({width: width, height: height, top: top, left: left})
- },
- reset: () => {
- set(state => {
- designerState.designerSwitch = state.designerSwitch;
- return designerState;
- });
- },
- setNotification: (notificationBadge: boolean, notificationMessage: [string, string]) => {
- set({notificationBadge: notificationBadge, notificationMessage: notificationMessage})
- },
- setMoveElements: (moveElements: [string | undefined, string | undefined]) => {
- set({moveElements: moveElements})
- },
- setPropertyPlaceholders: (propertyPlaceholders: [string, string][]) => {
- set((state: DesignerState) => {
- state.propertyPlaceholders.length = 0;
- state.propertyPlaceholders.push(...propertyPlaceholders);
- return state;
- })
- },
- setParameterPlaceholders: (parameterPlaceholders: [string, string][]) => {
- set((state: DesignerState) => {
- state.parameterPlaceholders.length = 0;
- state.parameterPlaceholders.push(...parameterPlaceholders);
- return state;
- })
- },
- setBeans: (beans: BeanFactoryDefinition[]) => {
- set((state: DesignerState) => {
- return {beans: [...beans]};
- })
- },
- setTab: (tab?: DesignerViewSwitchOption) => {
- set({tab: tab})
- },
- setDesignerSwitch: (designerSwitch: boolean) => {
- set({designerSwitch: designerSwitch})
- },
- setStepDoubleClicked: (stepDoubleClicked: boolean) => {
- set({stepDoubleClicked: stepDoubleClicked})
- },
-}), shallow)
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/designer/ErrorBoundaryWrapper.tsx b/karavan-app/src/main/webui/src/karavan/features/project/designer/ErrorBoundaryWrapper.tsx
deleted file mode 100644
index 36ac98dc..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/designer/ErrorBoundaryWrapper.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import React, {ReactNode} from "react";
-
-export interface ErrorBoundaryState {
- hasError: boolean;
- error: Error | null;
-}
-
-interface ErrorBoundaryProps {
- children: ReactNode;
- onError: (error: Error) => void;
-}
-
-export class ErrorBoundaryWrapper extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
- constructor(props: ErrorBoundaryProps) {
- super(props);
- this.state = { hasError: false, error: null };
- }
-
- static getDerivedStateFromError(error: Error): ErrorBoundaryState {
- return { hasError: true, error };
- }
-
- componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
- // Handle error (logging, etc.)
- console.error("Error caught in ErrorBoundary:", error, errorInfo);
- this.props.onError(error);
- }
-
- render() {
- if (this.state.hasError) {
- return <div style={{ color: "red" }}>Something went wrong: {this.state.error?.message}</div>;
- }
- return this.props.children;
- }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/designer/KaravanDesigner.css b/karavan-app/src/main/webui/src/karavan/features/project/designer/KaravanDesigner.css
deleted file mode 100644
index 19898c41..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/designer/KaravanDesigner.css
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.karavan .karavan-designer-page {
- height: 100vh;
- width: 100%;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- position: relative;
-}
-
-.karavan .karavan-designer-view-switcher {
- position: absolute;
- width: 125px;
- right: 1px;
- top: 1px;
- z-index: 100;
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/designer/KaravanDesigner.tsx b/karavan-app/src/main/webui/src/karavan/features/project/designer/KaravanDesigner.tsx
deleted file mode 100644
index eda53963..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/designer/KaravanDesigner.tsx
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect, useState} from 'react';
-import './KaravanDesigner.css';
-import {RouteDesigner} from "./route/RouteDesigner";
-import {CamelDefinitionYaml} from "@karavan-core/api/CamelDefinitionYaml";
-import {Integration, IntegrationFile} from "@karavan-core/model/IntegrationDefinition";
-import {CamelUtil} from "@karavan-core/api/CamelUtil";
-import {CamelUi} from "./utils/CamelUi";
-import {useDesignerStore, useIntegrationStore} from "./DesignerStore";
-import {shallow} from "zustand/shallow";
-import {InfrastructureAPI} from "./utils/InfrastructureAPI";
-import {EventBus, IntegrationUpdate} from "./utils/EventBus";
-import {RestDesigner} from "./rest/RestDesigner";
-import {BeansDesigner} from "./beans/BeansDesigner";
-import {KameletDesigner} from "./kamelet/KameletDesigner";
-import {BeanFactoryDefinition, RouteDefinition, RouteTemplateDefinition} from "@karavan-core/model/CamelDefinition";
-import {ErrorBoundaryState, ErrorBoundaryWrapper} from "./ErrorBoundaryWrapper";
-import {Group, Panel, Separator} from 'react-resizable-panels';
-import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
-import {KaravanDesignerViewSwitch} from "@features/project/designer/KaravanDesignerViewSwitch";
-import {MainPropertiesPanel} from "@features/project/designer/property/MainPropertiesPanel";
-
-interface Props {
- onSave: (filename: string, yaml: string, propertyOnly: boolean) => void
- onSaveCustomCode: (name: string, code: string, active: boolean) => void
- onGetCustomCode: (name: string, javaType: string) => Promise<string | undefined>
- onSavePropertyPlaceholder: (key: string, value: string) => void
- onInternalConsumerClick: (uri?: string, name?: string, routeId?: string, fileName?: string) => void
- onCreateNewRoute: (componentName: string, propertyName: string, propertyValue: string) => void
- onCreateNewFile: (fileName: string, code: string, open: boolean) => void
- filename: string
- yaml: string
- showCodeTab: boolean
- tab?: "routes" | "rest" | "beans" | "kamelet"
- propertyPlaceholders: [string, string][]
- beans: BeanFactoryDefinition[]
- files: IntegrationFile[]
-}
-
-export function KaravanDesigner(props: Props) {
-
- const [setSelectedStep, reset, badge, message, setPropertyPlaceholders, setBeans, tab, setTab, selectedStep, setSelectedUuids, setDesignerSwitch] =
- useDesignerStore((s) =>
- [s.setSelectedStep, s.reset, s.notificationBadge, s.notificationMessage, s.setPropertyPlaceholders, s.setBeans, s.tab, s.setTab,
- s.selectedStep, s.setSelectedUuids, s.setDesignerSwitch], shallow)
- const [integration, setIntegration, resetFiles] = useIntegrationStore((s) =>
- [s.integration, s.setIntegration, s.resetFiles], shallow)
-
- useEffect(() => {
- const sub = EventBus.onIntegrationUpdate()?.subscribe((update: IntegrationUpdate) =>
- save(update.integration, update.propertyOnly));
- try {
- resetErrorBoundary();
- InfrastructureAPI.setOnSaveCustomCode(props.onSaveCustomCode);
- InfrastructureAPI.setOnGetCustomCode(props.onGetCustomCode);
- InfrastructureAPI.setOnSave(props.onSave);
- InfrastructureAPI.setOnSavePropertyPlaceholder(props.onSavePropertyPlaceholder);
- InfrastructureAPI.setOnInternalConsumerClick(props.onInternalConsumerClick);
- InfrastructureAPI.setOnCreateNewRoute(props.onCreateNewRoute);
- InfrastructureAPI.setOnCreateNewFile(props.onCreateNewFile);
-
- const i = makeIntegration(props.yaml, props.filename);
- setIntegration(i, false);
- let designerTab = i.kind === 'Kamelet' ? 'kamelet' : props.tab;
- if (designerTab === undefined) {
- const counts = CamelUi.getFlowCounts(i);
- designerTab = (counts.get('routes') || 0) > 0 ? 'routes' : designerTab;
- designerTab = (counts.get('rest') || 0) > 0 ? 'rest' : designerTab;
- designerTab = (counts.get('beans') || 0) > 0 ? 'beans' : designerTab;
- }
- setTab(designerTab || 'routes')
- reset();
- setPropertyPlaceholders(props.propertyPlaceholders)
- setBeans(props.beans)
- resetFiles(props.files)
- resolveSelectedStep(i);
- } catch (e: any) {
- console.error(e)
- EventBus.sendAlert(' ' + e?.name, '' + e?.message, 'danger');
- }
- return () => {
- sub?.unsubscribe();
- setSelectedStep(undefined);
- reset();
- resetErrorBoundary();
- setIntegration(Integration.createNew("demo"), false);
- };
- }, []);
-
- function resolveSelectedStep(i: Integration) {
- try {
- if (selectedStep) {
- const step = CamelDefinitionApiExt.findElementById(i, (selectedStep as any).id)
- if (step) {
- setSelectedStep(step);
- setSelectedUuids([step?.uuid])
- }
- } else {
- const r = CamelDefinitionApiExt.getFlowsOfTypes(integration, ['RouteDefinition', 'RouteTemplateDefinition'])?.at(0);
- if (r) {
- const step = r?.dslName === 'RouteDefinition' ? (r as RouteDefinition).from : (r as RouteTemplateDefinition).route?.from;
- if (step) {
- setSelectedStep(step);
- setSelectedUuids([step?.uuid])
- }
- }
- }
- } catch (error) {
- console.error(error);
- }
- }
-
- function makeIntegration(yaml: string, filename: string): Integration {
- try {
- const type = CamelDefinitionYaml.yamlIsIntegration(yaml);
- if (yaml && type !== 'none') {
- const i = CamelDefinitionYaml.yamlToIntegration(props.filename, props.yaml)
- return i;
- } else {
- return Integration.createNew(filename, 'plain');
- }
- } catch (e) {
- console.error(e)
- EventBus.sendAlert("Error parsing YAML", (e as Error).message, 'danger')
- return Integration.createNew(filename, 'plain');
- }
- }
-
- function save(integration: Integration, propertyOnly: boolean): void {
- const code = getCode(integration);
- props.onSave(props.filename, code, propertyOnly);
- }
-
- function getCode(integration: Integration): string {
- try {
- const clone = CamelUtil.cloneIntegration(integration);
- return CamelDefinitionYaml.integrationToYaml(clone);
- } catch (e) {
- console.error(e)
- EventBus.sendAlert('Error parsing Yaml', (e as Error).message, 'danger');
- return '';
- }
- }
-
- const [state, setState] = useState<ErrorBoundaryState>({hasError: false, error: null});
-
- const resetErrorBoundary = () => {
- setState({hasError: false, error: null});
- };
-
- // Mimic `getDerivedStateFromError`
- const handleError = (error: Error) => {
- setState({hasError: true, error});
- setDesignerSwitch(false)
- }
-
- useEffect(() => {
- if (state.hasError && state.error) {
- EventBus.sendAlert(state.error.message, state.error?.stack?.toString()?.substring(0, 300) || '', 'danger');
- }
- }, [state]);
-
- function getMainPart() {
- return (
- <div className="karavan-designer-page">
- <KaravanDesignerViewSwitch/>
- <ErrorBoundaryWrapper onError={handleError}>
- {tab === 'kamelet' && <KameletDesigner/>}
- {tab === 'routes' && <RouteDesigner/>}
- {tab === 'rest' && <RestDesigner/>}
- {tab === 'beans' && <BeansDesigner/>}
- </ErrorBoundaryWrapper>
- </div>
- )
- }
-
- return (
- (tab !== 'kamelet')
- ? <Group orientation="horizontal">
- <Panel minSize={10} defaultSize={70}>
- {getMainPart()}
- </Panel>
- <Separator className='resize-handler'/>
- <Panel minSize={10} defaultSize={30}>
- <MainPropertiesPanel/>
- </Panel>
- </Group>
- : <Group orientation="horizontal">
- {getMainPart()}
- </Group>
- )
-}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/features/project/designer/KaravanDesignerViewSwitch.tsx b/karavan-app/src/main/webui/src/karavan/features/project/designer/KaravanDesignerViewSwitch.tsx
deleted file mode 100644
index 49a825e2..00000000
--- a/karavan-app/src/main/webui/src/karavan/features/project/designer/KaravanDesignerViewSwitch.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import React from 'react';
-import {Menu, MenuContent, MenuItem, MenuList} from '@patternfly/react-core';
-import {DesignerViewSwitchOption, DesignerViewSwitchOptions, useDesignerStore, useIntegrationStore} from "@features/project/designer/DesignerStore";
-import {shallow} from "zustand/shallow";
-import {getDesignerIcon} from "@features/project/designer/icons/KaravanIcons";
-
-export function KaravanDesignerViewSwitch() {
-
- const [setSelectedStep, setTab, tab] = useDesignerStore((s) => [s.setSelectedStep, s.setTab, s.tab], shallow)
- const [integration] = useIntegrationStore((s) => [s.integration], shallow)
- const isKamelet = integration.type === 'kamelet';
-
- const onSelect = (_event: React.MouseEvent<Element, MouseEvent> | undefined, itemId: number | string | undefined) => {
- const item = itemId as string; // eslint-disable-next-line no-console
- if (DesignerViewSwitchOptions.includes(item as DesignerViewSwitchOption)) {
- setTab(item as DesignerViewSwitchOption);
- } else {
- setTab(undefined);
- }
- setSelectedStep(undefined);
- };
-
- function getMenuItem(name: string, title: string) {
- return (
- <MenuItem isSelected={tab === name} itemId={name} key={name} icon={getDesignerIcon(name)}>
- {title}
- </MenuItem>
- )
- }
-
- return (
- <div className="karavan-designer-view-switcher">
- <Menu onSelect={onSelect} activeItemId={tab}>
- <MenuContent>
- <MenuList>
- {isKamelet && getMenuItem("kamelet", "Kamelet Definitions")}
- {getMenuItem("routes", "Routes")}
- {!isKamelet && getMenuItem("rest", "REST")}
... 35474 lines suppressed ...