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 2025/12/08 16:18:20 UTC
(camel-karavan) 02/04: Prepare for 4.14.3
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 8c36fec42bbaf0dcbf1bdcc9dbd1449ef0602ab4
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Mon Dec 8 11:00:51 2025 -0500
Prepare for 4.14.3
---
.../main/webui/src/karavan/api/DiagnosticsApi.tsx | 70 ----------------------
.../src/main/webui/src/karavan/api/SystemApi.tsx | 50 +++++++++++++++-
.../features/system/app-props/AppPropsRow.tsx | 6 +-
.../features/system/app-props/AppPropsTable.tsx | 4 +-
.../karavan/features/system/env-vars/EnvVarRow.tsx | 4 +-
.../features/system/env-vars/EnvVarsTable.tsx | 4 +-
.../webui/src/karavan/models/DiagnosticsStore.ts | 28 ---------
.../webui/src/karavan/services/SystemService.ts | 16 +++--
.../main/webui/src/karavan/stores/SystemStore.ts | 13 +++-
9 files changed, 81 insertions(+), 114 deletions(-)
diff --git a/karavan-app/src/main/webui/src/karavan/api/DiagnosticsApi.tsx b/karavan-app/src/main/webui/src/karavan/api/DiagnosticsApi.tsx
deleted file mode 100644
index aaf9a097..00000000
--- a/karavan-app/src/main/webui/src/karavan/api/DiagnosticsApi.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import axios from "axios";
-import {AuthApi} from "@api/auth/AuthApi";
-import {ErrorEventBus} from "@bus/ErrorEventBus";
-import {CamelStatus} from "@models/ProjectModels";
-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 DiagnosticsApi {
-
- static async getAllCamelStatuses(after: (statuses: CamelStatus[]) => void) {
- instance.get('/ui/status/camel')
- .then(res => {
- if (res.status === 200) {
- 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 => {
- console.log(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/SystemApi.tsx b/karavan-app/src/main/webui/src/karavan/api/SystemApi.tsx
index 3bdd3bee..ccacb098 100644
--- a/karavan-app/src/main/webui/src/karavan/api/SystemApi.tsx
+++ b/karavan-app/src/main/webui/src/karavan/api/SystemApi.tsx
@@ -1,7 +1,8 @@
import axios from "axios";
import {AuthApi} from "@api/auth/AuthApi";
import {ErrorEventBus} from "@bus/ErrorEventBus";
-import {KubernetesConfigMap, KubernetesSecret} from "../models/SystemModels";
+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';
@@ -144,4 +145,51 @@ export class SystemApi {
ErrorEventBus.sendApiError(err);
});
}
+
+ // Env Vars
+ 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);
+ }
+ }).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/features/system/app-props/AppPropsRow.tsx b/karavan-app/src/main/webui/src/karavan/features/system/app-props/AppPropsRow.tsx
index c088f64e..a34d4068 100644
--- a/karavan-app/src/main/webui/src/karavan/features/system/app-props/AppPropsRow.tsx
+++ b/karavan-app/src/main/webui/src/karavan/features/system/app-props/AppPropsRow.tsx
@@ -1,10 +1,10 @@
-import {Buffer} from "buffer";
import React, {useState} from 'react';
import {Button, TextInput} from '@patternfly/react-core';
import {Td, Tr} from '@patternfly/react-table';
import ShowIcon from "@patternfly/react-icons/dist/esm/icons/eye-icon";
import HideIcon from "@patternfly/react-icons/dist/esm/icons/eye-slash-icon";
-import {DiagnosticsApi} from "@api/DiagnosticsApi";
+import {SystemApi} from "@api/SystemApi";
+import {Buffer} from 'buffer';
export interface Props {
name: string
@@ -19,7 +19,7 @@ export function AppPropsRow(props: Props) {
if (showValue) {
setShowValue(false)
} else {
- DiagnosticsApi.getAppPropValue(props.name, (val: string) => {
+ SystemApi.getAppPropValue(props.name, (val: string) => {
setValue(Buffer.from(val, 'base64').toString('binary'));
setShowValue(true);
});
diff --git a/karavan-app/src/main/webui/src/karavan/features/system/app-props/AppPropsTable.tsx b/karavan-app/src/main/webui/src/karavan/features/system/app-props/AppPropsTable.tsx
index ac36e229..8fc6cc21 100644
--- a/karavan-app/src/main/webui/src/karavan/features/system/app-props/AppPropsTable.tsx
+++ b/karavan-app/src/main/webui/src/karavan/features/system/app-props/AppPropsTable.tsx
@@ -3,11 +3,11 @@ import {Bullseye, EmptyState, Spinner} from '@patternfly/react-core';
import {InnerScrollContainer, OuterScrollContainer, Table, Td, Th, Thead, Tr} from '@patternfly/react-table';
import {shallow} from "zustand/shallow";
import {AppPropsRow} from "./AppPropsRow";
-import {useDiagnosticsStore} from "@models/DiagnosticsStore";
+import {useSystemStore} from "@stores/SystemStore";
export function AppPropsTable() {
- const [appProps, filter] = useDiagnosticsStore((s) => [s.appProps, s.filter], shallow);
+ const [appProps, filter] = useSystemStore((s) => [s.appProps, s.filter], shallow);
function getTableBody() {
return (
diff --git a/karavan-app/src/main/webui/src/karavan/features/system/env-vars/EnvVarRow.tsx b/karavan-app/src/main/webui/src/karavan/features/system/env-vars/EnvVarRow.tsx
index 92f039c0..0b5868a1 100644
--- a/karavan-app/src/main/webui/src/karavan/features/system/env-vars/EnvVarRow.tsx
+++ b/karavan-app/src/main/webui/src/karavan/features/system/env-vars/EnvVarRow.tsx
@@ -4,7 +4,7 @@ import {Button, TextInput} from '@patternfly/react-core';
import {Td, Tr} from '@patternfly/react-table';
import ShowIcon from "@patternfly/react-icons/dist/esm/icons/eye-icon";
import HideIcon from "@patternfly/react-icons/dist/esm/icons/eye-slash-icon";
-import {DiagnosticsApi} from "@api/DiagnosticsApi";
+import {SystemApi} from "@api/SystemApi";
const DEFAULT_VALUE = "**********************"
@@ -21,7 +21,7 @@ export function EnvVarRow(props: Props) {
if (showValue) {
setShowValue(false)
} else {
- DiagnosticsApi.getEnvVarValue(props.name, (val: string) => {
+ SystemApi.getEnvVarValue(props.name, (val: string) => {
setValue(Buffer.from(val, 'base64').toString('binary'));
setShowValue(true);
});
diff --git a/karavan-app/src/main/webui/src/karavan/features/system/env-vars/EnvVarsTable.tsx b/karavan-app/src/main/webui/src/karavan/features/system/env-vars/EnvVarsTable.tsx
index ebe56ae1..0933e863 100644
--- a/karavan-app/src/main/webui/src/karavan/features/system/env-vars/EnvVarsTable.tsx
+++ b/karavan-app/src/main/webui/src/karavan/features/system/env-vars/EnvVarsTable.tsx
@@ -3,11 +3,11 @@ import {Bullseye, EmptyState, Spinner} from '@patternfly/react-core';
import {InnerScrollContainer, OuterScrollContainer, Table, Td, Th, Thead, Tr} from '@patternfly/react-table';
import {shallow} from "zustand/shallow";
import {EnvVarRow} from "./EnvVarRow";
-import {useDiagnosticsStore} from "@models/DiagnosticsStore";
+import {useSystemStore} from "@stores/SystemStore";
export function EnvVarsTable() {
- const [envVars, filter] = useDiagnosticsStore((s) => [s.envVars, s.filter], shallow);
+ const [envVars, filter] = useSystemStore((s) => [s.envVars, s.filter], shallow);
function getTableBody() {
return (
diff --git a/karavan-app/src/main/webui/src/karavan/models/DiagnosticsStore.ts b/karavan-app/src/main/webui/src/karavan/models/DiagnosticsStore.ts
deleted file mode 100644
index c1d03167..00000000
--- a/karavan-app/src/main/webui/src/karavan/models/DiagnosticsStore.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import {createWithEqualityFn} from "zustand/traditional";
-import {shallow} from "zustand/shallow";
-
-interface DiagnosticsState {
- filter: string;
- setFilter: (filter: string) => void;
- envVars: string[];
- setEnvVars: (envVars: string[]) => void;
- appProps: string[];
- setAppProps: (appProps: string[]) => void;
-}
-
-export const useDiagnosticsStore = createWithEqualityFn<DiagnosticsState>((set) => ({
- filter: '',
- envVars: [],
- appProps: [],
- setFilter: (filter: string)=> {
- set({filter: filter});
- },
- setEnvVars: (envVars: string[]) => {
- set({envVars: envVars});
- },
- setAppProps: (appProps: string[]) => {
- set({appProps: appProps});
- }
-}), shallow)
-
-
diff --git a/karavan-app/src/main/webui/src/karavan/services/SystemService.ts b/karavan-app/src/main/webui/src/karavan/services/SystemService.ts
index bfb1a5ec..5e97ee9c 100644
--- a/karavan-app/src/main/webui/src/karavan/services/SystemService.ts
+++ b/karavan-app/src/main/webui/src/karavan/services/SystemService.ts
@@ -1,15 +1,21 @@
-import {useSystemStore} from "../stores/SystemStore";
-import {SystemApi} from "../api/SystemApi";
-import {KubernetesConfigMap, KubernetesSecret} from "../models/SystemModels";
+import {useSystemStore} from "@stores/SystemStore";
+import {SystemApi} from "@api/SystemApi";
+import {KubernetesConfigMap, KubernetesSecret} from "@models/SystemModels";
export class SystemService {
public static refresh() {
SystemApi.getSecrets((secrets: KubernetesSecret[]) => {
- useSystemStore.setState({secrets: secrets.sort((a, b) => a.name.localeCompare(b.name))});
+ useSystemStore.setState({secrets: [...secrets].sort((a, b) => a.name.localeCompare(b.name))});
});
SystemApi.getConfigMaps((configmaps: KubernetesConfigMap[]) => {
- useSystemStore.setState({configmaps: configmaps.sort((a, b) => a.name.localeCompare(b.name))});
+ useSystemStore.setState({configmaps: [...configmaps].sort((a, b) => a.name.localeCompare(b.name))});
+ });
+ SystemApi.getEnvVars((envVars: string[]) => {
+ useSystemStore.setState({envVars: [...envVars].sort()});
+ });
+ SystemApi.getAppProps((appProps: string[]) => {
+ useSystemStore.setState({appProps: [...appProps].sort()});
});
}
}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/karavan/stores/SystemStore.ts b/karavan-app/src/main/webui/src/karavan/stores/SystemStore.ts
index bf10b36a..bd3ea094 100644
--- a/karavan-app/src/main/webui/src/karavan/stores/SystemStore.ts
+++ b/karavan-app/src/main/webui/src/karavan/stores/SystemStore.ts
@@ -2,7 +2,6 @@ import {createWithEqualityFn} from "zustand/traditional";
import {shallow} from "zustand/shallow";
import {KubernetesConfigMap, KubernetesSecret} from "@models/SystemModels";
-
export const SystemMenus = ['containers', 'deployments', 'secrets', 'configMaps', 'envVars', 'appProps', 'log'] as const;
export type SystemMenu = typeof SystemMenus[number] ;
@@ -15,6 +14,10 @@ interface SystemState {
setConfigMaps: (configmaps: KubernetesConfigMap[]) => void;
tabIndex: SystemMenu;
setTabIndex: (tabIndex: SystemMenu | number) => void;
+ envVars: string[];
+ setEnvVars: (envVars: string[]) => void;
+ appProps: string[];
+ setAppProps: (appProps: string[]) => void;
}
export const useSystemStore = createWithEqualityFn<SystemState>((set) => ({
@@ -35,6 +38,14 @@ export const useSystemStore = createWithEqualityFn<SystemState>((set) => ({
const tab = typeof tabIndex === 'number' ? SystemMenus[tabIndex] : tabIndex;
set({tabIndex: tab});
},
+ envVars: [],
+ appProps: [],
+ setEnvVars: (envVars: string[]) => {
+ set({envVars: envVars});
+ },
+ setAppProps: (appProps: string[]) => {
+ set({appProps: appProps});
+ }
}), shallow)