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 2023/03/01 23:19:14 UTC
[camel-karavan] branch main updated: web app api call #658
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
The following commit(s) were added to refs/heads/main by this push:
new fdf7662d web app api call #658
fdf7662d is described below
commit fdf7662da84a649fd2f6d95735427c5aad195c2b
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Wed Mar 1 18:19:06 2023 -0500
web app api call #658
---
karavan-app/src/main/webui/src/Main.tsx | 10 +++++++++-
karavan-app/src/main/webui/src/api/KaravanApi.tsx | 11 +++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/karavan-app/src/main/webui/src/Main.tsx b/karavan-app/src/main/webui/src/Main.tsx
index 95ebab2f..6dcfaadd 100644
--- a/karavan-app/src/main/webui/src/Main.tsx
+++ b/karavan-app/src/main/webui/src/Main.tsx
@@ -28,7 +28,6 @@ import KameletsIcon from "@patternfly/react-icons/dist/js/icons/registry-icon";
import DashboardIcon from "@patternfly/react-icons/dist/js/icons/tachometer-alt-icon";
import EipIcon from "@patternfly/react-icons/dist/js/icons/topology-icon";
import ComponentsIcon from "@patternfly/react-icons/dist/js/icons/module-icon";
-import { PficonTemplateIcon } from '@patternfly/react-icons';
import {MainLogin} from "./MainLogin";
import {DashboardPage} from "./dashboard/DashboardPage";
@@ -127,6 +126,7 @@ export class Main extends React.Component<Props, State> {
});
this.updateKamelets();
this.updateComponents();
+ this.updateSupportedComponents();
}
updateKamelets: () => Promise<void> = async () => {
@@ -153,6 +153,14 @@ export class Main extends React.Component<Props, State> {
});
}
+ updateSupportedComponents: () => Promise<void> = async () => {
+ await new Promise(resolve => {
+ KaravanApi.getSupportedComponents(jsons => {
+ ComponentApi.saveSupportedComponents(jsons);
+ })
+ });
+ }
+
deleteErrorMessage = (id: string) => {
this.setState({alerts: this.state.alerts.filter(a => a.id !== id)})
}
diff --git a/karavan-app/src/main/webui/src/api/KaravanApi.tsx b/karavan-app/src/main/webui/src/api/KaravanApi.tsx
index d16e1083..195d5d2a 100644
--- a/karavan-app/src/main/webui/src/api/KaravanApi.tsx
+++ b/karavan-app/src/main/webui/src/api/KaravanApi.tsx
@@ -473,6 +473,17 @@ export class KaravanApi {
});
}
+ static async getSupportedComponents(after: (json: string) => void) {
+ instance.get('/api/supported-component')
+ .then(res => {
+ if (res.status === 200) {
+ after(JSON.stringify(res.data));
+ }
+ }).catch(err => {
+ console.log(err);
+ });
+ }
+
static async getOpenApis(after: (openapis: []) => void) {
instance.get('/api/openapi')
.then(res => {