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 629650b63bd88de801193e5e20cf4d056fedcc56
Author: Marat Gubaidullin <[email protected]>
AuthorDate: Fri Feb 27 16:17:50 2026 -0500

    Front-end API for 4.18.0
---
 .../src/main/webui/src/karavan/api/AccessApi.tsx   |  15 +++
 .../src/main/webui/src/karavan/api/CustomApi.ts    |  21 ---
 .../main/webui/src/karavan/api/DeveloperApi.tsx    |  22 ----
 .../src/main/webui/src/karavan/api/KaravanApi.tsx  | 141 +++++++++++++--------
 .../src/main/webui/src/karavan/api/LogWatchApi.tsx |   2 +-
 .../main/webui/src/karavan/api/NotificationApi.tsx |   2 -
 .../src/main/webui/src/karavan/api/SearchApi.tsx   |   2 +-
 .../src/main/webui/src/karavan/api/SystemApi.tsx   |   1 -
 8 files changed, 108 insertions(+), 98 deletions(-)

diff --git a/karavan-app/src/main/webui/src/karavan/api/AccessApi.tsx 
b/karavan-app/src/main/webui/src/karavan/api/AccessApi.tsx
index b1de7bda..dbc1dd71 100644
--- a/karavan-app/src/main/webui/src/karavan/api/AccessApi.tsx
+++ b/karavan-app/src/main/webui/src/karavan/api/AccessApi.tsx
@@ -97,6 +97,21 @@ export class AccessApi {
         }
     }
 
+    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)
diff --git a/karavan-app/src/main/webui/src/karavan/api/CustomApi.ts 
b/karavan-app/src/main/webui/src/karavan/api/CustomApi.ts
deleted file mode 100644
index 47c0d5e4..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/CustomApi.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import axios from "axios";
-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 CustomApi {
-
-    static async getBrand(after: (config: any) => void) {
-        instance.get('/brand', {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/DeveloperApi.tsx 
b/karavan-app/src/main/webui/src/karavan/api/DeveloperApi.tsx
deleted file mode 100644
index c85f156a..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/DeveloperApi.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import axios from "axios";
-import {AuthApi} from "@api/auth/AuthApi";
-import {ErrorEventBus} from "@bus/ErrorEventBus";
-
-axios.defaults.headers.common['Accept'] = 'application/json';
-axios.defaults.headers.common['Content-Type'] = 'application/json';
-const instance = AuthApi.getInstance();
-
-export class DeveloperApi {
-
-    static async transformRequest(json: string, yaml: string, after: 
(response: any) => void) {
-        instance.post(`/platform/developer/transformRequest/`, {dataSample: 
json, route: yaml})
-            .then(res => {
-                console.log("res", res);
-                after(res);
-            }).catch(err => {
-                console.error(err);
-                ErrorEventBus.sendApiError(err.message);
-                after(err);
-        });
-    }
-}
diff --git a/karavan-app/src/main/webui/src/karavan/api/KaravanApi.tsx 
b/karavan-app/src/main/webui/src/karavan/api/KaravanApi.tsx
index 2171365d..845c33c5 100644
--- a/karavan-app/src/main/webui/src/karavan/api/KaravanApi.tsx
+++ b/karavan-app/src/main/webui/src/karavan/api/KaravanApi.tsx
@@ -16,11 +16,25 @@
  */
 
 import axios, {AxiosResponse} from "axios";
-import {AppConfig, CamelStatus, CamelStatusName, ContainerStatus, 
DeploymentStatus, PodEvent, Project, ProjectFile, ProjectType, ServiceStatus} 
from "../models/ProjectModels";
+import {
+    AppConfig,
+    CamelStatus,
+    CamelStatusName,
+    ContainerStatus,
+    DeploymentStatus,
+    PodEvent,
+    Project,
+    ProjectCommited,
+    ProjectFile,
+    ProjectFileCommited,
+    ProjectType,
+    ServiceStatus
+} from "@models/ProjectModels";
 import {Buffer} from 'buffer';
-import {EventBus} from "@features/integration/designer/utils/EventBus";
+import {EventBus} from "@features/project/designer/utils/EventBus";
 import {ErrorEventBus} from "@bus/ErrorEventBus";
 import {AuthApi, getCurrentUser} from "@api/auth/AuthApi";
+import {ProjectFolderCommit} from "@stores/CommitsStore";
 
 const instance = AuthApi.getInstance();
 
@@ -72,8 +86,8 @@ export class KaravanApi {
         });
     }
 
-    static async getAllCamelStatuses(name: CamelStatusName, after: (statuses: 
CamelStatus[]) => void) {
-        instance.get(`/ui/status/camel/${name}`)
+    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);
@@ -93,6 +107,16 @@ export class KaravanApi {
             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 {
@@ -104,10 +128,12 @@ export class KaravanApi {
                 }).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")
         }
     }
 
@@ -176,6 +202,49 @@ export class KaravanApi {
             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 getProjectCommits(projectId: string, after: (commits: 
ProjectFolderCommit[]) => void) {
+        instance.get(`/ui/git/commits/${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}`)
@@ -304,48 +373,6 @@ export class KaravanApi {
         });
     }
 
-    static async getConfigurationFiles(after: (files: []) => void) {
-        instance.get('/ui/file/configuration')
-            .then(res => {
-                if (res.status === 200) {
-                    after(res.data);
-                }
-            }).catch(err => {
-            ErrorEventBus.sendApiError(err);
-        });
-    }
-
-
-    static async getTemplatesFiles(after: (files: []) => void) {
-        instance.get('/ui/file/templates')
-            .then(res => {
-                if (res.status === 200) {
-                    after(res.data);
-                }
-            }).catch(err => {
-            ErrorEventBus.sendApiError(err);
-        });
-    }
-
-    static async getBeanTemplatesFiles(after: (files: ProjectFile []) => void) 
{
-        instance.get('/ui/file/templates/beans')
-            .then(res => {
-                if (res.status === 200) {
-                    after(res.data);
-                }
-            }).catch(err => {
-            ErrorEventBus.sendApiError(err);
-        });
-    }
-
-    static async getDevModePodStatus(projectId: string, after: (res: 
AxiosResponse<ContainerStatus>) => void) {
-        instance.get('/ui/devmode/container/' + 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)
@@ -511,7 +538,7 @@ export class KaravanApi {
     }
 
     static async manageContainer(projectId: string,
-                                 type: 'devmode' | 'devservice' | 'packaged' | 
'internal' | 'build' | 'unknown',
+                                 type: 'devmode' | 'packaged' | 'internal' | 
'build' | 'unknown',
                                  name: string,
                                  command: 'deploy' | 'run' | 'pause' | 'stop' 
| 'delete',
                                  pullImage: 'always' | 'ifNotExists' | 'never',
@@ -524,7 +551,7 @@ export class KaravanApi {
         });
     }
 
-    static async deleteContainer(projectId: string, type: 'devmode' | 
'devservice' | 'packaged' | 'internal' | 'build' | 'unknown', name: string, 
after: (res: AxiosResponse<any>) => void) {
+    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);
@@ -705,8 +732,22 @@ export class KaravanApi {
         });
     }
 
-    static async getProjectActivity(after: (activity?: any) => void) {
-        instance.get('/ui/activity')
+    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);
diff --git a/karavan-app/src/main/webui/src/karavan/api/LogWatchApi.tsx 
b/karavan-app/src/main/webui/src/karavan/api/LogWatchApi.tsx
index bdbb9d73..76f9f493 100644
--- a/karavan-app/src/main/webui/src/karavan/api/LogWatchApi.tsx
+++ b/karavan-app/src/main/webui/src/karavan/api/LogWatchApi.tsx
@@ -17,7 +17,7 @@
 
 import {SsoApi} from "@api/auth/SsoApi";
 import {fetchEventSource} from "@microsoft/fetch-event-source";
-import {ProjectEventBus} from "../bus/ProjectEventBus";
+import {ProjectEventBus} from "@bus/ProjectEventBus";
 import {AuthApi, getCurrentUser} from "@api/auth/AuthApi";
 
 export class LogWatchApi {
diff --git a/karavan-app/src/main/webui/src/karavan/api/NotificationApi.tsx 
b/karavan-app/src/main/webui/src/karavan/api/NotificationApi.tsx
index 98363c20..88732ce7 100644
--- a/karavan-app/src/main/webui/src/karavan/api/NotificationApi.tsx
+++ b/karavan-app/src/main/webui/src/karavan/api/NotificationApi.tsx
@@ -31,13 +31,11 @@ export class NotificationApi {
     }
 
     static onSystemMessage (ev: EventSourceMessage) {
-        console.log(`onSystemMessage`, ev);
         const ke = NotificationApi.getKaravanEvent(ev, 'system');
         NotificationEventBus.sendEvent(ke);
     }
 
     static onUserMessage (ev: EventSourceMessage) {
-        console.log(`onUserMessage`, ev);
         const ke = NotificationApi.getKaravanEvent(ev, 'user');
         NotificationEventBus.sendEvent(ke);
     }
diff --git a/karavan-app/src/main/webui/src/karavan/api/SearchApi.tsx 
b/karavan-app/src/main/webui/src/karavan/api/SearchApi.tsx
index 31b7fa01..3e1f441d 100644
--- a/karavan-app/src/main/webui/src/karavan/api/SearchApi.tsx
+++ b/karavan-app/src/main/webui/src/karavan/api/SearchApi.tsx
@@ -1,6 +1,6 @@
 import axios from "axios";
 import {ErrorEventBus} from "@bus/ErrorEventBus";
-import {SearchResult} from "../models/SearchModels";
+import {SearchResult} from "@models/SearchModels";
 import {AuthApi} from "@api/auth/AuthApi";
 
 axios.defaults.headers.common['Accept'] = 'application/json';
diff --git a/karavan-app/src/main/webui/src/karavan/api/SystemApi.tsx 
b/karavan-app/src/main/webui/src/karavan/api/SystemApi.tsx
index ccacb098..b801e6d6 100644
--- a/karavan-app/src/main/webui/src/karavan/api/SystemApi.tsx
+++ b/karavan-app/src/main/webui/src/karavan/api/SystemApi.tsx
@@ -150,7 +150,6 @@ export class SystemApi {
     static async getEnvVars(after: (envVars: string[]) => void) {
         instance.get('/ui/diagnostics/env-vars', {headers: {'Accept': 
'application/json'}})
             .then(res => {
-                console.log(res)
                 if (res.status === 200) {
                     after(res.data);
                 }

Reply via email to