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:51 UTC
(camel-karavan) 07/18: Developer Dashboard
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 46c671384aeb29f9231238294e5c8787a548a293
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Fri Apr 3 12:56:50 2026 -0400
Developer Dashboard
---
.../src/ui/features/dashboard/DashboardFunc.ts | 78 +++++++
.../src/ui/features/dashboard/DashboardPage.tsx | 53 +++++
.../src/ui/features/dashboard/DashboardToolbar.tsx | 13 ++
.../dashboard/development/DashboardDevelopment.css | 225 +++++++++++++++++++++
.../development/DashboardDevelopmentCard.tsx | 27 +++
.../development/DashboardDevelopmentCardAction.tsx | 36 ++++
.../development/DashboardDevelopmentCardCommit.tsx | 50 +++++
.../DashboardDevelopmentCardCommits.tsx | 31 +++
.../DashboardDevelopmentCardProjectRow.tsx | 63 ++++++
.../DashboardDevelopmentCardProjects.tsx | 147 ++++++++++++++
.../development/DashboardDevelopmentCardStart.tsx | 51 +++++
.../development/DashboardDevelopmentCardTeam.tsx | 67 ++++++
.../DashboardDevelopmentCardTeamMember.tsx | 55 +++++
.../DashboardDevelopmentDrawerPanel.tsx | 32 +++
.../development/DashboardDevelopmentHook.tsx | 148 ++++++++++++++
.../development/DashboardDevelopmentLabel.tsx | 26 +++
.../DashboardDevelopmentProjectPanel.tsx | 104 ++++++++++
.../development/DashboardDevelopmentRefresher.tsx | 216 ++++++++++++++++++++
.../development/DashboardDevelopmentTab.tsx | 50 +++++
.../development/DashboardDevelopmentTopPanel.css | 38 ++++
.../development/DashboardDevelopmentTopPanel.tsx | 61 ++++++
.../DashboardDevelopmentTopPanelCard.tsx | 41 ++++
.../src/ui/features/dashboard/useDashboardHook.tsx | 104 ++++++++++
.../main/webui/src/ui/stores/ProjectInfoStore.ts | 74 +++++++
24 files changed, 1790 insertions(+)
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/DashboardFunc.ts b/karavan-app/src/main/webui/src/ui/features/dashboard/DashboardFunc.ts
new file mode 100644
index 00000000..0cd7ed1e
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/DashboardFunc.ts
@@ -0,0 +1,78 @@
+import {Metric, MetricValue} from "@models/DashboardModels";
+
+export function getRoutesFromMetric(metric: Metric) {
+ const routes: string[] = [];
+ if (metric.inflightList) routes.push(...metric.inflightList.map(e => e.name));
+ if (metric.failedList) routes.push(...metric.failedList.map(e => e.name));
+ if (metric.succeededList) routes.push(...metric.succeededList.map(e => e.name));
+ if (metric.totalList) routes.push(...metric.totalList.map(e => e.name));
+ return routes;
+}
+
+export function merge(first: number[], second: number[]): number[] {
+ if (first === undefined || first.length === 0) {
+ return second;
+ } else if (first.length > second.length) {
+ return first.map((value, index) => value + (second.at(index) || 0));
+ } else {
+ return second.map((value, index) => value + (first.at(index) || 0));
+ }
+}
+
+export function calculateSum(values: number[]) {
+ if (values === undefined ||values.length === 0) {
+ return 0;
+ } else if (values.length === 1) {
+ return values.at(0) || 0;
+ }
+ return values.map(v => v).reduce((a, b) => (a || 0) + b);
+}
+
+export function getValueFromMetricByRoute(routeId: string, values: MetricValue[]) {
+ return values?.filter(v => v.name === routeId).map(v => v.value).at(0) || 0;
+}
+
+export function getMetricValueSum(values: MetricValue[]) {
+ if (values.length === 0) {
+ return 0;
+ } else if (values.length === 1) {
+ return values.at(0)?.value || 0;
+ }
+ return values.map(v => v.value).reduce((a, b) => (a || 0) + b);
+}
+
+export function getExchangesSum(metrics: Metric[], containerName?: string) {
+ let inflight = 0;
+ let failedDiff = 0;
+
+ metrics.filter(m => containerName === undefined || m.containerName === containerName).forEach(m => {
+ inflight = inflight + m.inflight;
+ failedDiff = inflight + m.failedDiff;
+ })
+ return {inflight, failedDiff}
+}
+
+export function sumMetrics(metrics: Metric[]): Metric[] {
+ const sumsByEnv: { [key: string]: Metric } = {};
+
+ // Sum values for each `env`
+ metrics.forEach(metric => {
+ if (!sumsByEnv[metric.env]) {
+ sumsByEnv[metric.env] = new Metric();
+ sumsByEnv[metric.env].env = metric.env;
+ sumsByEnv[metric.env].inflight = metric.inflight;
+ sumsByEnv[metric.env].total = metric.total;
+ sumsByEnv[metric.env].failed = metric.failed;
+ sumsByEnv[metric.env].succeeded = metric.succeeded;
+ } else {
+ sumsByEnv[metric.env].inflight += metric.inflight;
+ sumsByEnv[metric.env].total += metric.total;
+ sumsByEnv[metric.env].failed += metric.failed;
+ sumsByEnv[metric.env].succeeded += metric.succeeded;
+ }
+ });
+
+ // Convert the sums map to an array of `Metric` instances
+ return Object.values(sumsByEnv);
+}
+
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/DashboardPage.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/DashboardPage.tsx
new file mode 100644
index 00000000..4863fc73
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/DashboardPage.tsx
@@ -0,0 +1,53 @@
+import React, {useState} from 'react';
+import {capitalize, Content, Nav, NavItem, NavList} from '@patternfly/react-core';
+import {DashboardToolbar} from "./DashboardToolbar";
+import {RightPanel} from "@shared/ui/RightPanel";
+import DashboardDevelopmentTab from "@features/dashboard/development/DashboardDevelopmentTab";
+
+export const DashboardMenus = ['development', 'operations'] as const;
+export type DashboardMenu = typeof DashboardMenus[number];
+
+export function DashboardPage() {
+
+ const [currentMenu, setCurrentMenu] = useState<DashboardMenu>(DashboardMenus[0]);
+
+ const onNavSelect = (_: any, selectedItem: {
+ groupId: number | string;
+ itemId: number | string;
+ to: string;
+ }) => setCurrentMenu(selectedItem.itemId as DashboardMenu);
+
+ function title() {
+ return (
+ <Content component="h2">Dashboard</Content>
+ );
+ }
+
+ function getNavigation() {
+ return (
+ <Nav onSelect={onNavSelect} aria-label="Nav" variant="horizontal">
+ <NavList>
+ {DashboardMenus.map((item, i) =>
+ <NavItem key={item} preventDefault itemId={item} isActive={currentMenu === item} to="#">
+ {capitalize(item)}
+ </NavItem>
+ )}
+ </NavList>
+ </Nav>
+ )
+ }
+
+ return (
+ <RightPanel
+ title={title()}
+ toolsStart={getNavigation()}
+ tools={<DashboardToolbar/>}
+ mainPanel={
+ <div className="right-panel-card">
+ {currentMenu === 'development' && <DashboardDevelopmentTab/>}
+ </div>
+ }
+ />
+ )
+
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/DashboardToolbar.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/DashboardToolbar.tsx
new file mode 100644
index 00000000..59c3ee76
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/DashboardToolbar.tsx
@@ -0,0 +1,13 @@
+import React from 'react';
+import '@features/project/designer/karavan.css';
+import {PlatformNameForToolbar} from "@shared/ui/PlatformLogos";
+
+export function DashboardToolbar () {
+
+ return (
+ <div id="toolbar-group-types" style={{height: '65px'}}>
+ {PlatformNameForToolbar()}
+ </div>
+ )
+
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopment.css b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopment.css
new file mode 100644
index 00000000..29f38075
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopment.css
@@ -0,0 +1,225 @@
+.integration-development-panel {
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ height: 100%;
+ overflow: auto;
+ background-color: var(--pf-t--global--background--color--secondary--default);
+
+ .integration-development-grid {
+ padding: 16px;
+
+ .integration-development-panel-column {
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+ }
+
+ .dashboard-development-card {
+ overflow: hidden;
+ .pf-v6-c-card__header {
+ padding: 16px;
+ }
+ .pf-v6-c-card__body {
+ padding: 16px;
+ }
+ }
+
+ .start-actions {
+ display: flex;
+ flex-flow: wrap;
+ justify-content: space-between;
+ gap: 16px;
+ }
+ .action-card {
+ overflow: hidden;
+ /*height: 100%;*/
+ flex: 1 1 120px;
+ min-width: 0;
+ .pf-v6-c-card__header {
+ padding: 8px;
+ .pf-v6-c-card__actions {
+ padding: 0;
+ }
+ .pf-v6-c-card__clickable-action {
+ padding: 0;
+ }
+ }
+ .action-card-header {
+ display: flex;
+ flex-direction: column;
+ justify-content: flex-start;
+ align-items: center;
+ text-align: center;
+ gap: 4px;
+ .title {
+ font-weight: bold;
+ /*color: var(--pf-t--global--text--color--subtle);*/
+ }
+ }
+ .header-icon {
+ color: var(--pf-t--global--text--color--link--default);
+ height: 20px;
+ width: 20px;
+ }
+ .description {
+ font-size: var(--pf-t--global--font--size--xs);
+ color: var(--pf-t--global--text--color--subtle);
+ word-break: break-word;
+ }
+ }
+
+ .project-table-wrapper {
+ .pf-v6-c-card__body {
+ padding: 0;
+ }
+ }
+
+ .projects-table {
+ .pf-v6-c-table__thead {
+ /*background-color: var(--pf-t--global--background--color--secondary--default);*/
+ border-bottom: var(--pf-t--global--border--color--default) solid 1px;
+ .pf-v6-c-table__th {
+ padding-left: 16px;
+ padding-top: 16px;
+ padding-bottom: 16px;
+ }
+ }
+
+ .pf-v6-c-table__td {
+ padding: 0 8px 0 8px;
+ }
+ }
+ .project-card {
+ overflow: hidden;
+ .pf-v6-c-card__clickable-action::before {
+ border: none;
+ }
+ .project-card-body {
+ display: flex;
+ flex-direction: column;
+ justify-content: flex-start;
+ gap: 4px;
+ }
+
+ .pf-v6-c-button {
+ text-decoration: none;
+ padding: 8px;
+ }
+ }
+ .project-has-error::before {
+ border: var(--pf-v6-c-card--BorderColor) var(--pf-v6-c-card--BorderStyle) var(--pf-v6-c-card--BorderWidth);
+ border-color: var(--pf-t--global--text--color--status--danger--default);
+ }
+
+ .pf-v6-c-label__icon {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ .dashboard-icon-info {
+ fill: var(--pf-v6-c-label--m-outline__icon--Color);
+ width: 1em;
+ height: 1em;
+ }
+ }
+
+ .user-card {
+ display:flex;
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+ gap: 8px;
+ position: relative;
+ padding: 8px;
+ .user-card-title {
+ flex: 1;
+ display:flex;
+ flex-direction: column;
+ justify-content: flex-start;
+ align-items: flex-start;
+ gap: 4px;
+ }
+ .beating-heart-icon {
+ /* Apply the animation to loop infinitely every 1.5 seconds */
+ animation: heartbeat-pulse 2s infinite;
+ /* Required for transforms to work correctly on SVGs */
+ display: inline-block;
+ transform-origin: center;
+ }
+ }
+
+ .user-card::before {
+ position: absolute;
+ inset: 0;
+ pointer-events: none;
+ content: "";
+ border: var(--pf-t--global--icon--color--disabled) var(--pf-v6-c-card--BorderStyle) var(--pf-v6-c-card--BorderWidth);
+ border-radius: 1em;
+ }
+
+ .card-alive::before {
+ border-color: var(--pf-t--color--green--40);
+ }
+ .card-working::before {
+ border-color: var(--pf-t--color--green--40);
+ }
+
+ .user-card-empty-wrapper {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: stretch;
+ gap: 8px;
+ .user-card-empty {
+ flex: 1 1 auto;
+ max-width: 60px;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ padding: 8px;
+ position: relative;
+ opacity: 0.7;
+ }
+ .user-card-empty::before {
+ position: absolute;
+ inset: 0;
+ pointer-events: none;
+ content: "";
+ border: var(--pf-t--global--icon--color--disabled) var(--pf-v6-c-card--BorderStyle) var(--pf-v6-c-card--BorderWidth);
+ border-radius: 1em;
+ }
+ }
+
+ .commit-progress-step {
+ .pf-v6-c-progress-stepper__step-main {
+ margin-block-end: 0.7em;
+ }
+ .pf-v6-c-clipboard-copy__actions-item .pf-v6-c-button.pf-m-plain {
+ padding: 0;
+ }
+ }
+ .commit-card {
+ font-family: monospace;
+ font-size: 12px;
+ line-height: 14px;
+ .pf-v6-c-button.pf-m-link.pf-m-inline {
+ padding: 0 4px 0 0;
+ text-decoration: none;
+ }
+ }
+
+ .commit-description {
+ display:flex;
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+ gap: 4px;
+ p {
+ font-size: 12px;
+ }
+ .pf-v6-c-label__text {
+ font-size: 12px;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCard.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCard.tsx
new file mode 100644
index 00000000..438214c5
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCard.tsx
@@ -0,0 +1,27 @@
+import React from 'react';
+import {Card, CardBody, CardHeader, CardTitle, Content, Divider} from '@patternfly/react-core';
+import './DashboardDevelopment.css'
+
+interface Props {
+ title?: string,
+ body: React.ReactNode,
+ className?: string
+}
+
+export function DashboardDevelopmentCard(props: Props): React.ReactElement {
+
+ const {title, body, className} = props;
+ return (
+ <Card className={`dashboard-development-card ${className}`}>
+ {title &&
+ <CardHeader>
+ <CardTitle id={title}>
+ <Content component='h6'>{title}</Content>
+ </CardTitle>
+ </CardHeader>
+ }
+ <Divider/>
+ <CardBody>{body}</CardBody>
+ </Card>
+ )
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardAction.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardAction.tsx
new file mode 100644
index 00000000..41fecfb9
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardAction.tsx
@@ -0,0 +1,36 @@
+import React from 'react';
+import {Card, CardHeader, Content} from '@patternfly/react-core';
+
+interface Props {
+ title: string,
+ description: string,
+ icon: React.ReactNode,
+ action: () => void;
+}
+
+export function DashboardDevelopmentCardAction(props: Props): React.ReactElement {
+
+ const {title, description, icon, action} = props;
+ return (
+ <Card isClickable className={"action-card"}>
+ <CardHeader
+ selectableActions={{
+ // eslint-disable-next-line no-console
+ onClickAction: () => action(),
+ selectableActionAriaLabelledby: 'clickable-card-example-title-1'
+ }}
+ >
+ <div className="action-card-header">
+ <div className="header-icon">
+ {icon}
+ </div>
+ <Content component={'p'} className={"title"}>{title}</Content>
+ <Content component={'p'} className={"description"}>{description}</Content>
+ {/*<HelperText>*/}
+ {/* <HelperTextItem>{description}</HelperTextItem>*/}
+ {/*</HelperText>*/}
+ </div>
+ </CardHeader>
+ </Card>
+ )
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardCommit.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardCommit.tsx
new file mode 100644
index 00000000..a443eb86
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardCommit.tsx
@@ -0,0 +1,50 @@
+import React from 'react';
+import {SystemCommit} from "@stores/CommitsStore";
+import {Button, Content, HelperText, HelperTextItem, Label, ProgressStep} from "@patternfly/react-core";
+import TimeAgo from "javascript-time-ago";
+import {Commit} from "@carbon/icons-react";
+import {useActivityStore} from "@stores/ActivityStore";
+
+interface Props {
+ commit: SystemCommit
+}
+
+export function DashboardDevelopmentCardCommit(props: Props): React.ReactElement {
+
+ const {commit} = props;
+ const {usersActivities} = useActivityStore();
+ const userHeartbeat = usersActivities?.HEARTBEAT?.[commit.authorName];
+ const alive = userHeartbeat !== undefined;
+ const commitId = commit.id?.substring((commit.id?.length - 6) || 0);
+ const timeAgo = new TimeAgo('en-US')
+ const projectsCount = commit?.projectIds?.length || 0;
+ const projectId = `${commit?.projectIds?.at(0)}` + (projectsCount > 1 ? ` (+${projectsCount - 1})` : "");
+
+ return (
+ <ProgressStep
+ className={"commit-progress-step"}
+ variant={alive ? "success" : "info"}
+ icon={<Commit className={"carbon"} style={{height: "20px", width:"20px"}}/>}
+ description={
+ <div className={"commit-description"}>
+ <Content component='p' style={{flex: 1, fontWeight: "bold"}}>{commit.authorName}</Content>
+ <Label color="green" variant="filled" isCompact>
+ {timeAgo.format(new Date(commit.commitTime))}
+ </Label>
+ </div>
+ }
+ id={commit.id}
+ titleId="basic-alignment-step1-title"
+ aria-label="completed step, step with success"
+ >
+ <HelperText className={"commit-card"}>
+ <HelperTextItem>
+ {projectId && <Button variant={"link"} isInline>{projectId}</Button>}
+ </HelperTextItem>
+ <HelperTextItem>
+ {commit.message}
+ </HelperTextItem>
+ </HelperText>
+ </ProgressStep>
+ )
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardCommits.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardCommits.tsx
new file mode 100644
index 00000000..562d6f10
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardCommits.tsx
@@ -0,0 +1,31 @@
+import {DashboardDevelopmentCard} from "@features/dashboard/development/DashboardDevelopmentCard";
+import * as React from "react";
+import {useAccessStore} from "@stores/AccessStore";
+import {shallow} from "zustand/shallow";
+import {useCommitsStore} from "@stores/CommitsStore";
+import {ProgressStepper} from "@patternfly/react-core";
+import {DashboardDevelopmentCardCommit} from "@features/dashboard/development/DashboardDevelopmentCardCommit";
+
+export function DashboardDevelopmentCardCommits() {
+
+ const [users] = useAccessStore((s) => [s.users], shallow);
+ const {systemCommits} = useCommitsStore();
+
+ return (
+ <DashboardDevelopmentCard title={"Last commits"} body={
+ <div style={{gap: 8}}>
+ <ProgressStepper
+ isVertical={true}
+ isCenterAligned={false}
+ aria-label="Basic progress stepper with alignment"
+ >
+ {systemCommits
+ .slice(0, 10)
+ .map((commit) => {
+ return (<DashboardDevelopmentCardCommit key={commit.id} commit={commit}/>)
+ })}
+ </ProgressStepper>
+ </div>
+ }/>
+ )
+}
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardProjectRow.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardProjectRow.tsx
new file mode 100644
index 00000000..45c88ac1
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardProjectRow.tsx
@@ -0,0 +1,63 @@
+import React from 'react';
+import {Button, Content, Label} from '@patternfly/react-core';
+import {BUILD_IN_PROJECTS, Project, ProjectCommited} from "@models/ProjectModels";
+import {ComplexityProject} from "@features/projects/ComplexityModels";
+import {ProjectInfo} from "@models/CatalogModels";
+import {useNavigate} from "react-router-dom";
+import {useValidationStore} from "@stores/ValidationStore";
+import {Td, Tr} from "@patternfly/react-table";
+import CheckCircleIcon from "@patternfly/react-icons/dist/esm/icons/check-circle-icon";
+import {ROUTES} from "@app/navigation/Routes";
+import {ProjectsTableRowTimeLine} from "@features/projects/ProjectsTableRowTimeLine";
+import {ProjectStatusLabel} from "@features/projects/ProjectStatusLabel";
+import {ProjectsTableRowComplexity} from "@features/projects/ProjectsTableRowComplexity";
+import {ProjectsTableRowActivity} from "@features/projects/ProjectsTableRowActivity";
+
+interface Props {
+ project: Project,
+ projectCommited: ProjectCommited,
+ complexity: ComplexityProject
+ activeUsers: string[]
+ labels: string[]
+ projectInfo: ProjectInfo
+}
+
+export function DashboardDevelopmentCardProjectRow(props: Props): React.ReactElement {
+
+ const {validations} = useValidationStore();
+ const {project, complexity, activeUsers, labels, projectInfo, projectCommited} = props;
+ const navigate = useNavigate();
+ const validation = validations?.find(v => v.projectId === project.projectId);
+ const hasErrors = validation?.hasErrors;
+ const errorCount = validation?.files?.filter(f => f.hasErrors)?.length || 0;
+ const color = hasErrors ? "var(--pf-t--global--icon--color--status--danger--default)" : "var(--pf-t--global--icon--color--status--success--default)"
+ const isBuildIn = BUILD_IN_PROJECTS.includes(project.projectId);
+ return (
+ <Tr key={project.projectId} style={{verticalAlign: "middle"}} className={"project-card"}>
+ <Td>
+ <Button isInline variant={"link"} onClick={() => navigate(`${ROUTES.PROJECTS}/${project.projectId}`)}>
+ <Content component={'p'}>{project.name}</Content>
+ <div>{project.projectId}</div>
+ </Button>
+ </Td>
+ <Td textCenter>
+ {hasErrors
+ ? <Label status={'danger'} variant={'outline'}>{errorCount}</Label>
+ : <CheckCircleIcon color={color}/>
+ }
+ </Td>
+ <Td modifier={"nowrap"} textCenter>
+ <ProjectsTableRowTimeLine project={project} projectCommited={projectCommited} />
+ </Td>
+ <Td noPadding textCenter>
+ <ProjectsTableRowComplexity complexity={complexity}/>
+ </Td>
+ <Td noPadding>
+ {!isBuildIn && <ProjectsTableRowActivity activeUsers={activeUsers}/>}
+ </Td>
+ <Td modifier='fitContent' style={{paddingInlineEnd: 0, paddingInlineStart: '6px'}}>
+ {!isBuildIn && <ProjectStatusLabel projectId={project.projectId}/>}
+ </Td>
+ </Tr>
+ )
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardProjects.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardProjects.tsx
new file mode 100644
index 00000000..826a2fda
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardProjects.tsx
@@ -0,0 +1,147 @@
+import {DashboardDevelopmentCard} from "@features/dashboard/development/DashboardDevelopmentCard";
+import * as React from "react";
+import {useState} from "react";
+import {useProjectsStore} from "@stores/ProjectStore";
+import {shallow} from "zustand/shallow";
+import {ComplexityProject} from "@features/projects/ComplexityModels";
+import {KaravanApi} from "@api/KaravanApi";
+import {ComplexityApi} from "@features/projects/ComplexityApi";
+import {useDataPolling} from "@shared/polling/useDataPolling";
+import {useActivityStore} from "@stores/ActivityStore";
+import {Table, Tbody, Td, Th, Thead, Tr} from "@patternfly/react-table";
+import {DashboardDevelopmentCardProjectRow} from "@features/dashboard/development/DashboardDevelopmentCardProjectRow";
+import {Bullseye, Button, Checkbox, Content, ProgressStep, ProgressStepper, Spinner} from "@patternfly/react-core";
+import {ProjectType} from "@models/ProjectModels";
+import {useProjectInfoStore} from "../../../stores/ProjectInfoStore";
+
+const DEFAULT_LENGTH = 7;
+
+export function DashboardDevelopmentCardProjects() {
+
+ const [projects, projectsCommited] = useProjectsStore((s) => [s.projects, s.projectsCommited], shallow)
+ const [projectInfos, fetchProjectInfos] = useProjectInfoStore(state => [state.projectInfos, state.fetchProjectInfos]);
+ const {projectsActivities, fetchProjectsActivities} = useActivityStore();
+ const [complexities, setComplexities] = useState<ComplexityProject[]>([]);
+ const [labels, setLabels] = useState<any>();
+ const [showSystem, setShowSystem] = useState<boolean>(false);
+ const [currentLength, setCurrentLength] = useState<number>(DEFAULT_LENGTH);
+
+ useDataPolling('DashboardDevelopmentCardProjects', refreshActivity, 5000);
+
+ function refreshActivity() {
+ fetchProjectsActivities();
+ KaravanApi.getProjectsLabels(data => {
+ setLabels(data);
+ });
+ ComplexityApi.getComplexityProjects(complexities => {
+ setComplexities(complexities);
+ })
+ fetchProjectInfos();
+ }
+
+ function setNewLength(dir: number){
+ const next = currentLength + dir * DEFAULT_LENGTH/2;
+ const length = next < DEFAULT_LENGTH ? DEFAULT_LENGTH : (next >= complexities.length) ? complexities.length : next;
+ setCurrentLength(length);
+ }
+
+ function showMore() {
+ const canMore = complexities?.length > currentLength;
+ const canLess = (currentLength - DEFAULT_LENGTH) > 0;
+ return (
+ <Tr key={"show-more"} style={{verticalAlign: "middle"}}>
+ <Td colSpan={1} >
+ <Checkbox id={"showAll"}
+ label={'Show system projects'}
+ isChecked={showSystem}
+ onChange={(_, checked) => setShowSystem(checked)}
+ />
+ </Td>
+ <Td modifier='fitContent' colSpan={5} style={{textAlign: "end", paddingTop: 8, paddingBottom: 8}} >
+ <div>
+ <Button isInline
+ variant={'link'}
+ style={{visibility: !canLess ? "hidden" : "visible"}}
+ onClick={_ => setNewLength(-1)}
+ >Show less</Button>
+ <Button isInline
+ style={{visibility: !canMore ? "hidden" : "visible"}}
+ variant={'link'}
+ onClick={_ => setNewLength(+1)}
+ >Show more</Button>
+ </div>
+ </Td>
+ </Tr>
+ )
+ }
+
+ function getTableEmpty() {
+ return (
+ <Tr>
+ <Td colSpan={6} height={300}>
+ <Bullseye >
+ <Spinner size="xl"/>
+ </Bullseye>
+ </Td>
+ </Tr>
+ )
+ }
+
+ function getTableBody() {
+ const list = showSystem ? complexities : complexities.filter(c => c.type === ProjectType.integration);
+ return (list
+ .sort((a, b) => a.lastUpdateDate > b.lastUpdateDate ? -1 : 1)
+ .slice(0, currentLength)
+ .map((complexity) => {
+ const project = projects.find(p => p.projectId === complexity.projectId);
+ const activity = projectsActivities?.[project.projectId];
+ const activeUsers: string [] = (activity && Array.isArray(activity)) ? activity : [];
+ const projectInfo = projectInfos.find(p => p.projectId === project.projectId);
+ const projectCommited = projectsCommited.find(pc => pc.projectId === project.projectId);
+ return (
+ <DashboardDevelopmentCardProjectRow
+ key={project.projectId}
+ project={project}
+ projectCommited={projectCommited}
+ activeUsers={activeUsers}
+ labels={Array.isArray(labels?.[project.projectId]) ? labels?.[project.projectId] : []}
+ complexity={complexity}
+ projectInfo={projectInfo}
+ />
+ )
+ })
+ )
+ }
+
+ return (
+ <DashboardDevelopmentCard className={"project-table-wrapper"} body={
+ <Table variant={'compact'} className={"projects-table"}>
+ <Thead>
+ <Tr>
+ <Th key='project'>
+ <Content component={'h6'}>Recent Projects</Content>
+ </Th>
+ <Th key='validation' modifier='fitContent' textCenter>Validation</Th>
+ <Th key='timeline'>
+ <ProgressStepper isCenterAligned className={"projects-table-header-progress-stepper"}>
+ <ProgressStep id="commited" titleId="commited">
+ <div style={{textWrap: 'nowrap'}}>Commited</div>
+ </ProgressStep>
+ <ProgressStep id="saved" titleId="saved">
+ <div style={{textWrap: 'nowrap'}}>Saved</div>
+ </ProgressStep>
+ </ProgressStepper>
+ </Th>
+ <Th key='complexity' modifier={"fitContent"}>Complexity</Th>
+ <Th key='users' modifier={"fitContent"}>Active Users</Th>
+ <Th key='status' modifier={"fitContent"} textCenter>Status</Th>
+ </Tr>
+ </Thead>
+ <Tbody>
+ {complexities && complexities.length > 0 ? getTableBody() : getTableEmpty()}
+ {complexities && complexities.length > 0 && showMore()}
+ </Tbody>
+ </Table>
+ }/>
+ )
+}
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardStart.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardStart.tsx
new file mode 100644
index 00000000..13420578
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardStart.tsx
@@ -0,0 +1,51 @@
+import {DashboardDevelopmentCard} from "@features/dashboard/development/DashboardDevelopmentCard";
+import * as React from "react";
+import {useState} from "react";
+import {CamelIcon, OpenApiIcon} from "@features/project/designer/icons/KaravanIcons";
+import {DashboardDevelopmentCardAction} from "@features/dashboard/development/DashboardDevelopmentCardAction";
+import {useNavigate} from "react-router-dom";
+import {useDashboardStore} from "@stores/DashboardStore";
+import {UploadProjectModal} from "@features/projects/UploadProjectModal";
+import UploadIcon from "@patternfly/react-icons/dist/esm/icons/upload-icon";
+
+export function DashboardDevelopmentCardStart() {
+ const {setShowSideBar} = useDashboardStore();
+ const [showUpload, setShowUpload] = useState<boolean>(false);
+ const navigate = useNavigate();
+
+ return (
+ <DashboardDevelopmentCard body={
+ <div className={"start-actions"}>
+ <DashboardDevelopmentCardAction
+ title={"Create Integration"}
+ description={"Start a new Apache Camel project"}
+ icon={
+ <svg width="20" height="20">
+ <g transform={"scale(0.6, 0.6)"}>
+ <CamelIcon />
+ </g>
+ </svg>
+ }
+ action={() => {
+ setShowSideBar("integration", "Create Apache Camel integration project");
+ }}
+ />
+ <DashboardDevelopmentCardAction
+ title={"Design OpenAPI"}
+ description={"Start a new REST service project"}
+ icon={<OpenApiIcon width={20} height={20}/>}
+ action={() => {
+ setShowSideBar("openAPI", "Create Project with OpenAPI Service")
+ }}
+ />
+ <DashboardDevelopmentCardAction
+ title={"Import Project"}
+ description={"Import existing project from zip file"}
+ icon={<UploadIcon style={{width: "18px", height: "18px"}}/>}
+ action={() => setShowUpload(true)}
+ />
+ {showUpload && <UploadProjectModal open={showUpload} onClose={() => setShowUpload(false)}/>}
+ </div>
+ }/>
+ )
+}
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardTeam.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardTeam.tsx
new file mode 100644
index 00000000..42892d2f
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardTeam.tsx
@@ -0,0 +1,67 @@
+import {DashboardDevelopmentCard} from "@features/dashboard/development/DashboardDevelopmentCard";
+import * as React from "react";
+import {AccessService} from "@services/AccessService";
+import {useAccessStore} from "@stores/AccessStore";
+import {shallow} from "zustand/shallow";
+import {DashboardDevelopmentCardTeamMember} from "@features/dashboard/development/DashboardDevelopmentCardTeamMember";
+import {useActivityStore} from "@stores/ActivityStore";
+import {useDataPolling} from "@shared/polling/useDataPolling";
+
+export function DashboardDevelopmentCardTeam() {
+
+ const [users] = useAccessStore((s) => [s.users], shallow);
+ const {fetchUsersActivities, usersActivities} = useActivityStore();
+
+ useDataPolling('DashboardDevelopmentCardTeam', refreshActivity, 5000);
+
+ function refreshActivity() {
+ fetchUsersActivities();
+ AccessService.refreshAccess()
+ }
+
+ return (
+ <DashboardDevelopmentCard title={"Team"} body={
+ <div className="integration-development-panel-column" style={{gap: 8}}>
+ {users
+ // .filter(u => {
+ // const w = usersActivities?.WORKING?.[u.username]?.timeStamp;
+ // const h = usersActivities?.HEARTBEAT?.[u.username]?.timeStamp;
+ // return w !== undefined || h !== undefined;
+ // })
+ .sort((a, b) => {
+ const aWork = usersActivities?.WORKING?.[a.username]?.timeStamp ?? 0;
+ const aHeart = usersActivities?.HEARTBEAT?.[a.username]?.timeStamp ?? 0;
+ const bWork = usersActivities?.WORKING?.[b.username]?.timeStamp ?? 0;
+ const bHeart = usersActivities?.HEARTBEAT?.[b.username]?.timeStamp ?? 0;
+ const getPriority = (work: number, heart: number) => {
+ if (work > 0) return 0; // WORKING
+ if (heart > 0) return 1; // HEARTBEAT
+ return 2; // NEITHER
+ };
+
+ const pA = getPriority(aWork, aHeart);
+ const pB = getPriority(bWork, bHeart);
+
+ if (pA !== pB) return pA - pB;
+
+ return a.username.localeCompare(b.username);
+ })
+ .map((user) => {
+ return (<DashboardDevelopmentCardTeamMember key={user.username} user={user}/>)
+ })}
+ {/*<div className="user-card-empty-wrapper">*/}
+ {/* {users*/}
+ {/* .filter(u => {*/}
+ {/* const w = usersActivities?.WORKING?.[u.username]?.timeStamp;*/}
+ {/* const h = usersActivities?.HEARTBEAT?.[u.username]?.timeStamp;*/}
+ {/* return w === undefined && h === undefined;*/}
+ {/* }).sort((a, b) => a.username.localeCompare(b.username))*/}
+ {/* .map((user) => {*/}
+ {/* return (<DashboardDevelopmentTeamMember key={user.username} user={user}/>)*/}
+ {/* })}*/}
+ {/* <div style={{flex: '1 1 auto'}}></div>*/}
+ {/*</div>*/}
+ </div>
+ }/>
+ )
+}
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardTeamMember.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardTeamMember.tsx
new file mode 100644
index 00000000..2edfbf78
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentCardTeamMember.tsx
@@ -0,0 +1,55 @@
+import React from 'react';
+import {Badge, Content} from '@patternfly/react-core';
+import {AccessUser} from "@models/AccessModels";
+import {useActivityStore} from "@stores/ActivityStore";
+import TimeAgo from "javascript-time-ago";
+import {HeartbeatIcon} from "@patternfly/react-icons";
+import {Asleep} from "@carbon/icons-react";
+import {SvgIcon} from "@shared/icons/SvgIcon";
+
+interface Props {
+ user: AccessUser
+}
+
+export function DashboardDevelopmentCardTeamMember(props: Props): React.ReactElement {
+
+ const {user} = props;
+ const {usersActivities} = useActivityStore();
+ const userHeartbeat = usersActivities?.HEARTBEAT?.[user.username];
+ const alive = userHeartbeat !== undefined;
+ const userWorking = usersActivities?.WORKING?.[user.username];
+ const working = userWorking !== undefined;
+ const timeAgo = new TimeAgo('en-US')
+ const lastActive = working ? timeAgo.format(userWorking?.timeStamp, 'mini-minute-now') : undefined;
+ const fontColor = alive ? 'var(--pf-t--global--text--color--subtle)' : 'var(--pf-t--global--icon--color--disabled)';
+ const iconColor = working
+ ? 'var(--pf-t--color--green--40)'
+ : alive ? 'var(--pf-t--color--green--40)' : 'var(--pf-t--global--icon--color--disabled)';
+ const icon = working
+ ? <SvgIcon icon={"working"} fill={iconColor} width={22} height={22} />
+ : (alive ? <HeartbeatIcon color={iconColor} width={22} height={22} className={'beating-heart-icon'}/> : <Asleep color={iconColor}/>)
+ const cardClassName = working ? "card-working" : (alive ? "card-alive" : "")
+
+ // if (!alive && !working) {
+ // return (
+ // <div className={`user-card-empty`}>
+ // {icon}
+ // <div style={{paddingLeft: 2}}>{`${user.firstName?.substring(0, 1)?.toUpperCase()}`}</div>
+ // <div>{`${user.lastName?.substring(0, 1)?.toUpperCase()}`}</div>
+ // </div>
+ // )
+ // } else {
+ return (
+ <div className={`user-card ${cardClassName}`}>
+ <div style={{width: '24px', display: 'flex', justifyContent: 'center'}}>
+ {icon}
+ </div>
+ <div className={"user-card-title"}>
+ {alive && <Content component='p' style={{lineHeight: '12px', color: fontColor}}>{`${user.firstName} ${user.lastName}`}</Content>}
+ <Content component='p' style={{fontWeight: 'bold', lineHeight: '10px', color: fontColor}}>{`${user.username}`}</Content>
+ </div>
+ {lastActive && <Badge style={{fontWeight: 'normal', backgroundColor: 'var(--pf-t--global--color--nonstatus--green--default)'}} isRead>{lastActive}</Badge>}
+ </div>
+ )
+ // }
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentDrawerPanel.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentDrawerPanel.tsx
new file mode 100644
index 00000000..c18a7895
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentDrawerPanel.tsx
@@ -0,0 +1,32 @@
+import React from 'react';
+import {Button, Content, Divider, DrawerHead, DrawerPanelBody, DrawerPanelContent,} from '@patternfly/react-core';
+import TimesIcon from "@patternfly/react-icons/dist/js/icons/times-icon";
+import {useDashboardStore} from "@stores/DashboardStore";
+import {DashboardDevelopmentProjectPanel} from "@features/dashboard/development/DashboardDevelopmentProjectPanel";
+
+export function DashboardDevelopmentDrawerPanel() {
+
+ const {setShowSideBar, showSideBar, title} = useDashboardStore();
+
+ return (
+ <DrawerPanelContent className='async-drawer-panel' maxSize={'1000px'} defaultSize={'500px'} minSize={'500px'} isResizable>
+ <DrawerHead>
+ <div style={{display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', padding: '16px 16px 16px 16px'}}
+ onClick={e => e.stopPropagation()}>
+ <Content style={{flex: 1}} component={'h6'}>{title}</Content>
+ <Button variant="link" icon={<TimesIcon/>} onClick={() => {
+ setShowSideBar(null);
+ }}></Button>
+ </div>
+ </DrawerHead>
+ <DrawerPanelBody>
+ <Divider style={{marginTop: 0}}/>
+ <div style={{display: 'flex', flexDirection: 'column', justifyContent: 'flex-start', padding: '16px 16px 16px 16px'}}
+ onClick={e => e.stopPropagation()}>
+ {showSideBar === 'integration' && <DashboardDevelopmentProjectPanel/>}
+ {showSideBar === 'openAPI' && <DashboardDevelopmentProjectPanel/>}
+ </div>
+ </DrawerPanelBody>
+ </DrawerPanelContent>
+ )
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentHook.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentHook.tsx
new file mode 100644
index 00000000..25eaf94a
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentHook.tsx
@@ -0,0 +1,148 @@
+import {useStatusesStore} from "@stores/ProjectStore";
+import {ROUTES} from "@app/navigation/Routes";
+import {useNavigate} from "react-router-dom";
+import {ProjectMetrics} from "@models/DashboardModels";
+import {useValidationStore} from "@stores/ValidationStore";
+import {Button, Content, Popover, Tooltip} from "@patternfly/react-core";
+import * as React from "react";
+import ExclamationCircleIcon from "@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon";
+
+export function DashboardDevelopmentHook() {
+
+ const [camelStatuses] = useStatusesStore((s) => [s.camelContexts])
+ const [validations] = useValidationStore((s) => [s.validations])
+ const navigate = useNavigate();
+
+ function selectFile(integration: string, fileName: string) {
+ navigate(`${ROUTES.PROJECTS}/${integration}/${fileName}`);
+ }
+
+ function getValidationInfo(projectId: string) {
+ return validations.find(v => v.projectId === projectId);
+ }
+
+ function getValidationInfoForFile(projectId: string, fileName: string) {
+ const validation = getValidationInfo(projectId);
+ return validation?.files?.find(f => f.name === fileName)
+ }
+
+ function getProjectValidationIcon(projectId: string) {
+ const validation = getValidationInfo(projectId);
+ const invalidFiles = validation?.files?.filter(f => f?.hasErrors)?.length ?? 0;
+ let labelIcon = undefined;
+ if (validation?.hasErrors) {
+ labelIcon = (
+ <Tooltip content={`Errors in ${invalidFiles} file(s)!`} className={'tooltip-danger'}>
+ <ExclamationCircleIcon className='validation-icon validation-icon-danger'/>
+ </Tooltip>
+ );
+ }
+ return labelIcon;
+ }
+
+ function getProjectValidationStatus(projectId: string) {
+ const validation = getValidationInfo(projectId);
+ const invalidFiles = validation?.files?.filter(f => f?.hasErrors)?.length ?? 0;
+ if (validation === undefined || validation === null || validation.files?.length === 0) {
+ return undefined;
+ } else if (invalidFiles > 0) {
+ return false;
+ }
+ return true;
+ }
+
+ function getProjectFileValidationIcon(projectId: string, fileName: string) {
+ const invalidFile = getValidationInfoForFile(projectId, fileName);
+ let labelIcon = undefined;
+ if (invalidFile?.hasErrors) {
+ labelIcon = (
+ <Tooltip content={`Errors in file ${invalidFile?.name}!`} className={'tooltip-danger'}>
+ <ExclamationCircleIcon className='validation-icon validation-icon-danger'/>
+ </Tooltip>
+ );
+ }
+ return labelIcon;
+ }
+
+ function getProjectFileValidationAlerts(projectId: string, fileName: string) {
+ try {
+ const invalidFile = getValidationInfoForFile(projectId, fileName);
+ if (invalidFile?.hasErrors) {
+ const errors = invalidFile?.errors;
+ if (errors && Array.isArray(errors)) {
+ return (
+ <Popover
+ className='popover-file-validation'
+ aria-label="Alert popover"
+ hasAutoWidth
+ alertSeverityVariant={'danger'}
+ headerContent="Validation Errors"
+ headerIcon={<ExclamationCircleIcon/>}
+ headerComponent="h1"
+ bodyContent={
+ <div style={{display: "flex", flexDirection: "column", justifyContent: "flex-start", alignItems: "stretch", gap: "8px"}}>
+ {errors.map((error, index) => {
+ const line = error?.details?.line;
+ const type = error?.property ? error?.property : error?.type;
+ const title = `Error at line ${line}: ${type}`
+ return (
+ <div key={index} style={{display: "flex", flexDirection: "column", justifyContent: "flex-start", gap: "3px"}}>
+ <Content style={{fontWeight: 'bold', margin: 0}} component="p">{title}</Content>
+ <Content style={{margin: 0}} component="p">{error?.message}</Content>
+ </div>
+ )
+ })}
+ </div>
+ }
+ appendTo={() => document.body}
+ >
+ <Button isInline variant={'link'} isDanger icon={<ExclamationCircleIcon/>}>Validation Error</Button>
+ </Popover>
+ )
+ }
+ }
+ } catch (err) {
+ console.error(err);
+ }
+ return undefined;
+ }
+
+
+ function getIntegrationMetrics(projectId: string): ProjectMetrics {
+ let remoteExchangesTotal: number = 0;
+ let remoteExchangesFailed: number = 0;
+ let remoteExchangesSucceeded: number = 0;
+ let remoteExchangesInflight: number = 0;
+ let exchangesTotal: number = 0;
+ let exchangesFailed: number = 0;
+ let exchangesInflight: number = 0;
+ let exchangesSucceeded: number = 0;
+ try {
+ const statuses = camelStatuses.filter(c => c.projectId === projectId) || [];
+ statuses.forEach(status => {
+ const contextStatuses = status.statuses.filter(s => s.name === 'context') || [];
+ contextStatuses.forEach(contextStatus => {
+ const contextStatusJson = contextStatus.status;
+ const statistics = (contextStatusJson ? JSON.parse(contextStatusJson) : {})?.context?.statistics;
+ remoteExchangesTotal = (statistics?.remoteExchangesTotal || 0) + remoteExchangesTotal;
+ remoteExchangesFailed = (statistics?.remoteExchangesFailed || 0) + remoteExchangesFailed;
+ remoteExchangesSucceeded = (remoteExchangesTotal - remoteExchangesFailed) + remoteExchangesSucceeded;
+ remoteExchangesInflight = (statistics?.remoteExchangesInflight || 0) + remoteExchangesInflight;
+
+ exchangesTotal = (statistics?.exchangesTotal || 0) + exchangesTotal;
+ exchangesFailed = (statistics?.exchangesFailed || 0) + exchangesFailed;
+ exchangesSucceeded = (exchangesTotal - exchangesFailed) + exchangesSucceeded;
+ exchangesInflight = (statistics?.exchangesInflight || 0) + exchangesInflight;
+ })
+ })
+ } catch (e) {
+ console.error(e);
+ }
+ return new ProjectMetrics(exchangesTotal, exchangesFailed, exchangesInflight, exchangesSucceeded);
+ }
+
+ return {
+ selectFile, getValidationInfoForFile, getProjectValidationIcon, getProjectFileValidationIcon,
+ getProjectFileValidationAlerts, getProjectValidationStatus
+ }
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentLabel.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentLabel.tsx
new file mode 100644
index 00000000..8f041c49
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentLabel.tsx
@@ -0,0 +1,26 @@
+import React from 'react';
+import {Label, Tooltip} from '@patternfly/react-core';
+
+interface Props {
+ tooltip?: string,
+ label?: any,
+ icon?: React.ReactNode,
+ status?: 'success' | 'warning' | 'danger' | 'info' | 'custom',
+ className?: string
+}
+
+export function DashboardDevelopmentLabel(props: Props) {
+
+ const {tooltip, label, status, icon, className} = props;
+ return (
+ tooltip
+ ? <Tooltip content={tooltip}>
+ <Label icon={icon} status={status} variant='outline' className={className || ''}>
+ {label}
+ </Label>
+ </Tooltip>
+ : <Label icon={icon} status={status} variant='outline' className={className || ''}>
+ {label}
+ </Label>
+ )
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentProjectPanel.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentProjectPanel.tsx
new file mode 100644
index 00000000..bcbb267a
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentProjectPanel.tsx
@@ -0,0 +1,104 @@
+import React, {useEffect} from 'react';
+import {Alert, FormAlert} from '@patternfly/react-core';
+import {useProjectsStore} from "@stores/ProjectStore";
+import {Project, RESERVED_WORDS} from "@models/ProjectModels";
+import {isValidProjectId, nameToProjectId} from "@util/StringUtils";
+import {EventBus} from "@features/project/designer/utils/EventBus";
+import {useForm} from "react-hook-form";
+import {AxiosResponse} from "axios";
+import {shallow} from "zustand/shallow";
+import {useDashboardStore} from "@stores/DashboardStore";
+import {ProjectService} from "@services/ProjectService";
+import {SideBarFormWrapper} from "@shared/ui/SideBarFormWrapper";
+import {useProjectInfoStore} from "../../../stores/ProjectInfoStore";
+import {useNavigate} from "react-router-dom";
+import {ROUTES} from "@app/navigation/Routes";
+import {ProjectFunctionHook} from "@app/navigation/ProjectFunctionHook";
+import {KaravanApi} from "@api/KaravanApi";
+import {useFormUtil} from "@util/useFormUtil";
+
+export function DashboardDevelopmentProjectPanel() {
+
+ const [projects] = useProjectsStore((s) => [s.projects], shallow);
+ const {fetchProjectInfos} = useProjectInfoStore();
+ const { showSideBar, setShowSideBar,} = useDashboardStore();
+
+ const [isProjectIdChanged, setIsProjectIdChanged] = React.useState(false);
+ const [backendError, setBackendError] = React.useState<string>();
+ const {createOpenApiForProject} = ProjectFunctionHook();
+ const navigate = useNavigate();
+
+ // 1. Setup Form
+ const formContext = useForm<Project>({ mode: "all" });
+ const { getTextField, getCheckbox } = useFormUtil(formContext);
+ const { reset, trigger, setValue, setFocus, watch } = formContext;
+
+ // 2. Prepare Data
+ useEffect(() => {
+ if (['integration', 'openAPI', 'mcp'].includes(showSideBar)) {
+ const p = new Project();
+ reset(p);
+ setBackendError(undefined);
+ setIsProjectIdChanged(false);
+ setTimeout(() => setFocus('name'), 300);
+ }
+ }, [showSideBar, reset, setFocus]);
+
+ // 3. Save Handler
+ const onSave = (data: Project) => {
+ KaravanApi.postProject(data, (result, res) => after(result, res, data));
+ }
+
+ function after(result: boolean, res: AxiosResponse<Project> | any, data: Project) {
+ if (result) {
+ EventBus.sendAlert("Success", "Project successfully created!", "success");
+ if (showSideBar === 'openAPI') {
+ createOpenApiForProject(data.projectId);
+ }
+ ProjectService.refreshProjects();
+ fetchProjectInfos();
+ setShowSideBar(null)
+ navigate(`${ROUTES.PROJECTS}/${data.projectId}`)
+ } else {
+ setBackendError(res?.response?.data);
+ }
+
+ }
+
+ // 4. Field Change Handlers
+ function onNameChange(value: string) {
+ if (!isProjectIdChanged) {
+ setValue('projectId', nameToProjectId(value), { shouldValidate: true });
+ }
+ }
+
+ function onIdChange(value: string) {
+ setIsProjectIdChanged(true);
+ }
+
+ return (
+ <SideBarFormWrapper
+ formContext={formContext}
+ selectedId={null} // "Create" mode
+ onSave={onSave}
+ onCancel={() => setShowSideBar(null)}
+ >
+
+ {getTextField('name', 'Name', {
+ length: (v: any) => v.length > 5 || 'Project name should be longer than 5 characters',
+ }, 'text', onNameChange)}
+
+ {getTextField('projectId', 'Project ID', {
+ regex: (v: any) => isValidProjectId(v) || 'Only lowercase characters, numbers and dashes allowed',
+ length: (v: any)=> v.length > 5 || 'Project ID should be longer than 5 characters',
+ name: (v: any) => !RESERVED_WORDS.includes(v) || "Reserved word",
+ uniques: (v: any) => !projects.map(p => p.projectId).includes(v) || "Project already exists!",
+ }, 'text', onIdChange)}
+ {backendError && (
+ <FormAlert>
+ <Alert variant="danger" title={backendError} aria-live="polite" isInline />
+ </FormAlert>
+ )}
+ </SideBarFormWrapper>
+ );
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentRefresher.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentRefresher.tsx
new file mode 100644
index 00000000..75a96334
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentRefresher.tsx
@@ -0,0 +1,216 @@
+import * as React from 'react';
+import {useEffect, useState} from 'react';
+import {useProjectsStore, useStatusesStore} from "@stores/ProjectStore";
+import {OperationStatistic} from "@models/CatalogModels";
+import {ProjectService} from "@services/ProjectService";
+import {useDataPolling} from "@shared/polling/useDataPolling";
+import {DashboardService} from "@services/DashboardService";
+import {INTERNAL_COMPONENTS} from "@core/api/ComponentApi";
+import {useContainerStatusesStore} from "@stores/ContainerStatusesStore";
+import {useValidationStore} from "@stores/ValidationStore";
+import {useCommitsStore} from "@stores/CommitsStore";
+import {useProjectInfoStore} from "../../../stores/ProjectInfoStore";
+
+export function DashboardDevelopmentRefresher() {
+
+ const {containers} = useContainerStatusesStore();
+ const [consumers, processors] = useStatusesStore((s) => [s.consumers, s.processors]);
+ const {fetchProjectsCommited} = useProjectsStore();
+ const {fetchValidations} = useValidationStore();
+ const {fetchSystemCommits} = useCommitsStore();
+ const [projectInfos, fetchProjectInfos] = useProjectInfoStore(s => [s.projectInfos, s.fetchProjectInfos]);
+ const [count, setCount] = useState<number>(0);
+ const [map, setMap] = useState<{projectId: string, state:string}[]>([]);
+
+ useDataPolling('DashboardDevelopmentRefresherRuntime', refreshRuntime, 3000);
+ useDataPolling('DashboardDevelopmentRefresherDesign', refreshDesign, 10000);
+
+ function refreshDesign() {
+ ProjectService.refreshProjects();
+ fetchValidations();
+ fetchSystemCommits();
+ fetchProjectsCommited();
+ fetchProjectInfos();
+ }
+
+ function refreshRuntime() {
+ ProjectService.refreshAllContainerStatuses();
+ ProjectService.refreshAllCamelProcessorStatuses();
+ ProjectService.refreshAllCamelConsumerStatuses();
+ ProjectService.refreshAllDeploymentStatuses();
+ ProjectService.refreshAllCamelContextStatuses();
+ ProjectService.refreshAllCamelRouteStatuses();
+ DashboardService.refreshAllHealth();
+ DashboardService.refreshAllMetrics();
+ }
+
+ useEffect(() => {
+ let needRefresh = false;
+ const containersCount = containers.length;
+ if (containersCount !== count) {
+ setCount(containersCount);
+ needRefresh = true;
+ } else {
+ const containerMap = containers
+ .filter(c => ['devmode', 'packaged'].includes(c.type))
+ .sort((a, b) => a.projectId.localeCompare(b.projectId))
+ .map(c => ({projectId: c.projectId, state: c.state}));
+ if (!mapsEqualUnordered(containerMap, map)) {
+ setMap(containerMap);
+ needRefresh = true;
+ }
+ }
+ if (needRefresh) {
+ fetchProjectInfos();
+ }
+ }, [containers]);
+
+
+ useEffect(() => {
+ try {
+ const stats: OperationStatistic[] = [];
+ consumers?.forEach(consumer => {
+ const consumerStats = consumer?.statuses?.find(s => s.name === 'consumer');
+ const statusText = consumerStats?.status;
+ (statusText ? JSON.parse(statusText) : {})?.consumer?.consumers?.forEach((consumerStatus: any) => {
+ if (consumerStatus?.remote) {
+ const stat = getConsumerStats(consumerStatus);
+ if (stat) {
+ stat.projectId = consumer.projectId;
+ stats.push(stat)
+ }
+ }
+ });
+ })
+ processors?.forEach(processor => {
+ const processorStats = processor?.statuses?.find(s => s.name === 'processor');
+ const statusText = processorStats?.status;
+ (statusText ? JSON.parse(statusText) : {})?.processor?.processors?.forEach((processorStatus: any) => {
+ const stat = getProcessorStats(processorStatus)
+ if (stat) {
+ stat.projectId = processor.projectId;
+ stats.push(stat);
+ }
+ });
+ })
+ } catch (err) {
+ console.error(err);
+ }
+ }, [consumers, processors, fetchProjectInfos]);
+
+
+ function getConsumerStats(consumerStatus: any): OperationStatistic | null {
+ try {
+ const from = consumerStatus.uri?.split('://');
+ const protocol = from?.[0]
+ const address = from?.[1]
+ const statistics = consumerStatus?.statistics;
+ const failed: number = statistics?.exchangesFailed ?? 0;
+ const inflight: number = statistics?.exchangesInflight ?? 0;
+ const total: number = statistics?.exchangesTotal ?? 0;
+ return {action: "receive", protocol, address, total, inflight, failed};
+ } catch (err) {
+ console.error(err);
+ return null;
+ }
+ }
+
+ function getProcessorStats(processorStatus: any): OperationStatistic | null {
+ try {
+ const dslName = processorStatus.processor;
+ if (['to', 'poll'].includes(dslName)) {
+ const routeId = processorStatus.routeId;
+ const nodePrefixId = processorStatus.nodePrefixId;
+ const id = processorStatus.id?.replace(nodePrefixId, "");
+ const info = findProcessorInfoById(routeId, nodePrefixId, id);
+ if (info) {
+ const protocol = info[0]
+ const address = info[1]
+ if (!INTERNAL_COMPONENTS.includes(protocol)) {
+ const statistics = processorStatus?.statistics;
+ const failed: number = statistics?.exchangesFailed ?? 0;
+ const inflight: number = statistics?.exchangesInflight ?? 0;
+ const total: number = statistics?.exchangesTotal ?? 0;
+ const action = dslName === "poll" ? "receive" : "send";
+ return {action, protocol, address, total, inflight, failed, };
+ }
+ return null;
+ } else {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ } catch (err) {
+ console.error(err);
+ return null;
+ }
+ }
+
+ function findProcessorInfoById(routeId:string, nodePrefixId: string, id: string): [string, string] | null{
+ try {
+ var componentInfo = projectInfos
+ .map(i => i.routes.find(r => areNodeIdsEqual(nodePrefixId, r.nodePrefixId)))
+ .filter(i => i !== undefined)
+ .map(r => [...r.consumers, ...r.producers].filter(c => c.id === id)?.[0])
+ .find(c => c !== undefined);
+ var protocol = componentInfo?.name;
+ var address = componentInfo?.parameters?.destinationName ?? componentInfo?.parameters?.topic ?? componentInfo?.parameters?.name;
+ return (protocol && address) ? [protocol, address] : null;
+ } catch (err) {
+ console.error(err);
+ return null;
+ }
+ }
+
+ function areNodeIdsEqual(a: string, b: string): boolean {
+ const normalize = (str: string) => str?.replace(/-\d+$/, "");
+ return normalize(a) === normalize(b);
+ }
+
+ function areStatsDifferent(stats1: OperationStatistic[], stats2: OperationStatistic[]): boolean {
+ if (stats1.length !== stats2.length) return true;
+
+ const key = (s: OperationStatistic) => `${s.action}␟${s.protocol}␟${s.address}`;
+
+ const map2 = new Map<string, OperationStatistic>();
+ for (const s of stats2) map2.set(key(s), s);
+
+ if (map2.size !== stats2.length) {
+ return true;
+ }
+
+ for (const s1 of stats1) {
+ const k = key(s1);
+ const s2 = map2.get(k);
+ if (!s2) return true; // missing -> new/removed
+ if (
+ s1.total !== s2.total ||
+ s1.inflight !== s2.inflight ||
+ s1.failed !== s2.failed
+ ) {
+ return true; // values changed
+ }
+ }
+ const set1 = new Set(stats1.map(key));
+ if (set1.size !== stats1.length) return true;
+ return false;
+ }
+
+ function mapsEqualUnordered(a: {projectId: string, state:string}[], b: {projectId: string, state:string}[]): boolean {
+ const sortById = (arr: {projectId: string, state:string}[]) =>
+ [...arr].sort((x, y) => x.projectId.localeCompare(y.projectId));
+
+ const sortedA = sortById(a);
+ const sortedB = sortById(b);
+
+ return sortedA.length === sortedB.length &&
+ sortedA.every((item, i) =>
+ item.projectId === sortedB[i].projectId && item.state === sortedB[i].state
+ );
+ }
+
+ return (
+ <>{}</>
+ );
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTab.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTab.tsx
new file mode 100644
index 00000000..815954a4
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTab.tsx
@@ -0,0 +1,50 @@
+import React from 'react';
+import './DashboardDevelopment.css'
+import {DashboardDevelopmentRefresher} from "@features/dashboard/development/DashboardDevelopmentRefresher";
+import {Drawer, DrawerContent, DrawerContentBody, Grid, GridItem} from "@patternfly/react-core";
+import {DashboardDevelopmentCardStart} from "@features/dashboard/development/DashboardDevelopmentCardStart";
+import {DashboardDevelopmentTopPanel} from "@features/dashboard/development/DashboardDevelopmentTopPanel";
+import {ErrorBoundaryWrapper} from "@shared/ui/ErrorBoundaryWrapper";
+import {DashboardDevelopmentDrawerPanel} from "@features/dashboard/development/DashboardDevelopmentDrawerPanel";
+import {useDashboardStore} from "@stores/DashboardStore";
+import {DashboardDevelopmentCardProjects} from "@features/dashboard/development/DashboardDevelopmentCardProjects";
+import {DashboardDevelopmentCardCommits} from "@features/dashboard/development/DashboardDevelopmentCardCommits";
+import {DashboardDevelopmentCardTeam} from "./DashboardDevelopmentCardTeam";
+
+
+function DashboardDevelopmentTab() {
+ const {showSideBar} = useDashboardStore();
+
+ return (
+ <Drawer isExpanded={showSideBar !== null} position="end" onExpand={_ => {}}>
+ <DrawerContent panelContent={<DashboardDevelopmentDrawerPanel/>}>
+ <DrawerContentBody>
+ <ErrorBoundaryWrapper onError={error => console.error(error)}>
+ <div className="integration-development-panel">
+ <DashboardDevelopmentRefresher />
+ <Grid hasGutter className="integration-development-grid">
+ <GridItem span={12}>
+ <DashboardDevelopmentTopPanel/>
+ </GridItem>
+ <GridItem span={9}>
+ <DashboardDevelopmentCardStart/>
+ </GridItem>
+ <GridItem span={3} rowSpan={2}>
+ <DashboardDevelopmentCardTeam/>
+ </GridItem>
+ <GridItem span={9} rowSpan={3}>
+ <DashboardDevelopmentCardProjects/>
+ </GridItem>
+ <GridItem span={3} rowSpan={1}>
+ <DashboardDevelopmentCardCommits/>
+ </GridItem>
+ </Grid>
+ </div>
+ </ErrorBoundaryWrapper>
+ </DrawerContentBody>
+ </DrawerContent>
+ </Drawer>
+ )
+}
+
+export default DashboardDevelopmentTab
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTopPanel.css b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTopPanel.css
new file mode 100644
index 00000000..21fef149
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTopPanel.css
@@ -0,0 +1,38 @@
+.dashboard-development-top-card {
+ padding: 0;
+
+ .toggle-card {
+ /* 1. Allows cards to grow and fill space */
+ flex: 1 1 auto;
+ /* 2. Set a minimum width before it forces a wrap */
+ /* Adjust 200px to whatever the "smallest" readable size is for your cards */
+ min-width: 10px;
+ /* 3. Optional: prevents cards from getting unnaturally wide on huge screens */
+ max-width: 400px;
+ /* Ensure internal content doesn't overflow during shrink */
+ overflow: hidden;
+ min-height: 51.5px;
+
+ .top-card-header .pf-v6-c-card__header-main {
+ display: flex;
+ justify-content: space-between;
+ color: var(--pf-t--global--color--brand--default);
+ }
+
+ .top-card-body {
+ flex-wrap: nowrap; /* Keep inner icons on one line */
+ .top-label {
+ min-width: 60px;
+ }
+ .top-label-disabled {
+ opacity: 0.5;
+ }
+ }
+
+ .icon-left {
+ .pf-v6-c-label__content {
+ flex-direction: row-reverse;
+ }
+ }
+ }
+}
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTopPanel.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTopPanel.tsx
new file mode 100644
index 00000000..a1927f29
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTopPanel.tsx
@@ -0,0 +1,61 @@
+import React from 'react';
+import "./DashboardDevelopmentTopPanel.css"
+import {useDashboardHook} from "@features/dashboard/useDashboardHook";
+import UpIcon from "@patternfly/react-icons/dist/esm/icons/running-icon";
+import {InProgressIcon} from "@patternfly/react-icons";
+import {Apps, CategoryNewEach, Gears, Idea, MessageQueue} from "@carbon/icons-react";
+import {DashboardDevelopmentTopPanelCard} from "@features/dashboard/development/DashboardDevelopmentTopPanelCard";
+import {Card, CardBody} from "@patternfly/react-core";
+import CheckCircleIcon from "@patternfly/react-icons/dist/esm/icons/check-circle-icon";
+import ExclamationCircleIcon from "@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon";
+
+export function DashboardDevelopmentTopPanel() {
+
+ const {
+ healthUp,
+ routeStateCounts,
+ routesCount,
+ messagesSucceeded,
+ messagesInflight,
+ messagesFailed,
+ integrationsCount,
+ healthDown,
+ } = useDashboardHook();
+
+ const className = "toggle-card";
+
+ return (
+ <Card isCompact className="dashboard-development-top-card">
+ <CardBody>
+ <div style={{
+ display: "flex",
+ flexDirection: 'row',
+ justifyContent: "flex-start",
+ alignItems: "center",
+ gap: "8px",
+ flexWrap: 'wrap', // Keeps wrapping enabled
+ width: '100%' // Ensures it fills the parent
+ }}>
+ {DashboardDevelopmentTopPanelCard("Projects", <Apps />, [
+ {label: integrationsCount, tooltip: "Designed", status: "info", icon: <Idea/>},
+ {label: healthUp, tooltip: "Started", status: "success", icon: <UpIcon className={"talisman-container-button-icon-up"}/>},
+ // {label: healthDown, tooltip: "Down", status: "danger", icon: <DownIcon/>},
+ ], className)}
+ {DashboardDevelopmentTopPanelCard("Routes", <CategoryNewEach />, [
+ {label: routesCount, tooltip: "Designed", status: "info", icon: <Idea/>},
+ {label: routeStateCounts["Started"] ?? 0, tooltip: "Started", status: "success", icon: <Gears />},
+ // {label: routeStateCounts["Suspended"] ?? 0, tooltip: "Suspended", status: "warning", icon: getDesignerIcon('routes', 'dashboard-icon-info')},
+ // {label: routeStateCounts["Stopped"] ?? 0, tooltip: "Stopped", status: "danger", icon: getDesignerIcon('routes', 'dashboard-icon-info')},
+ // {label: healthDown, tooltip: "Down", status: "danger", icon: <DownIcon/>},
+ ], className)}
+ {DashboardDevelopmentTopPanelCard("Messages", <MessageQueue />, [
+ {label: messagesSucceeded, tooltip: "Succeeded", status: "success", icon: <CheckCircleIcon/>},
+ {label: messagesFailed, tooltip: "Failed", status: "danger", icon: <ExclamationCircleIcon/>},
+ {label: messagesInflight, tooltip: "InFlight", status: "info", icon: <InProgressIcon/>},
+ // {label: lastFailedTime, tooltip: "Last Failed Time", status: "info", icon: <TimesIcon/>},
+ ], className)}
+ </div>
+ </CardBody>
+ </Card>
+ )
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTopPanelCard.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTopPanelCard.tsx
new file mode 100644
index 00000000..45ef83d1
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/development/DashboardDevelopmentTopPanelCard.tsx
@@ -0,0 +1,41 @@
+import React from 'react';
+import {Card, CardBody, CardHeader, Content, HelperText, HelperTextItem, Label} from '@patternfly/react-core';
+
+export interface DashboardDevelopmentTopPanelCardElement {
+ tooltip: string,
+ label: number,
+ icon?: React.ReactNode,
+ status?: 'success' | 'warning' | 'danger' | 'info' | 'custom',
+ className?: string
+}
+
+export function DashboardDevelopmentTopPanelCard(title: string, icon: React.ReactNode, elements: DashboardDevelopmentTopPanelCardElement[], className?: string) {
+ const form = new Intl.NumberFormat('en-US');
+ return (
+ <Card isCompact className={className}>
+ <CardHeader className={"top-card-header"}>
+ <Content component='h6'>{title}</Content>
+ {icon}
+ </CardHeader>
+ <CardBody className="top-card-body">
+ <div style={{display: "flex", flexDirection: "row", justifyContent: 'space-between'}}>
+ {elements.filter(e => e.label !== undefined).map((element, i) => {
+ const zero = element.label === 0;
+ const status = zero ? undefined : element.status;
+ const className = zero ? 'top-label-disabled' : '';
+ return (
+ <div key={i} style={{display: "flex", flexDirection: "column", alignItems: "center"}} className={className}>
+ <Label icon={element.icon} isDisabled={zero} status={status} variant='outline' className={`top-label ${element.className}`}>
+ {form.format(element.label)}
+ </Label>
+ <HelperText>
+ <HelperTextItem>{element.tooltip}</HelperTextItem>
+ </HelperText>
+ </div>
+ )
+ })}
+ </div>
+ </CardBody>
+ </Card>
+ )
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/features/dashboard/useDashboardHook.tsx b/karavan-app/src/main/webui/src/ui/features/dashboard/useDashboardHook.tsx
new file mode 100644
index 00000000..ef6d3732
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/features/dashboard/useDashboardHook.tsx
@@ -0,0 +1,104 @@
+import {shallow} from "zustand/shallow";
+import {useHealthStore} from "@stores/DashboardStore";
+import {useAppConfigStore, useProjectsStore, useStatusesStore} from "@stores/ProjectStore";
+import {ContainerStatus, ProjectType} from "@models/ProjectModels";
+import TimeAgo from "javascript-time-ago";
+import {useContainerStatusesStore} from "@stores/ContainerStatusesStore";
+import {useProjectInfoStore} from "../../stores/ProjectInfoStore";
+
+export function useDashboardHook() {
+
+ const [projects] = useProjectsStore((s) => [s.projects], shallow)
+ const [dockerInfo] = useAppConfigStore((s) => [s.dockerInfo], shallow)
+ const {containers} = useContainerStatusesStore();
+ const [healths] = useHealthStore((s) => [s.healths], shallow)
+ const [camelStatuses] = useStatusesStore((state) => [state.camelContexts], shallow);
+ const [projectInfos] = useProjectInfoStore(s => [s.projectInfos]);
+ const [routes] = useStatusesStore((state) => [state.routes], shallow);
+
+ let messagesSucceeded: number = 0;
+ let messagesInflight: number = 0;
+ let messagesFailed: number = 0;
+ let lastFailedExchangeTimestamp: number = 0;
+
+ camelStatuses.forEach(camelStatus => {
+ const context = camelStatus.statuses.find(s => s.name === 'context');
+ const statusText = context?.status;
+ const status = statusText !== undefined ? JSON.parse(statusText) : {};
+ const c = status?.context;
+ messagesSucceeded = messagesSucceeded + ((c?.statistics?.exchangesTotal - c?.statistics?.exchangesFailed) || 0);
+ messagesFailed = messagesFailed + (c?.statistics?.exchangesFailed ?? 0);
+ messagesInflight = messagesInflight + (c?.statistics?.exchangesInflight ?? 0);
+ if (c?.statistics?.lastFailedExchangeTimestamp > lastFailedExchangeTimestamp) {
+ lastFailedExchangeTimestamp = c?.statistics?.lastFailedExchangeTimestamp;
+ }
+ })
+ const timeAgo = new TimeAgo('en-US')
+ const lastFailedString = lastFailedExchangeTimestamp ? new Date(lastFailedExchangeTimestamp).toISOString() : undefined;
+ const lastFailedTime = lastFailedExchangeTimestamp ? timeAgo.format(new Date(lastFailedExchangeTimestamp), 'mini-now') : undefined;
+
+ let cpuProcessUsage: number[] = [0]
+
+ const lastUsage = (cpuProcessUsage.length > 1 ? cpuProcessUsage.at(cpuProcessUsage.length - 1) : 0) || 0;
+ const fixed = lastUsage > 1 ? 1 : (lastUsage > 0.01 ? 2 : 4)
+
+ function getGigabytes(bytes?: number): number {
+ return bytes ? (bytes / 1024 / 1024 / 1024) : 0;
+ }
+
+ function getMemoryUsed(cs: ContainerStatus[]): number {
+ const memories = cs.map(c => {
+ const parts = c.memoryInfo?.split("/") || [];
+ const mString = parts?.at(0) || "0";
+ return parseFloat(mString.replace(/[^0-9.]/g, ''));
+ });
+
+ const memory = memories && memories.length > 0 ? memories.reduce((n1, n2) => n1 + n2) : 0;
+ return getGigabytes(memory * 1024 * 1024);
+ }
+
+ const totalMemory = getGigabytes(dockerInfo?.MemTotal);
+ const memoryUsed = getMemoryUsed(containers);
+ const memoryProjects = getMemoryUsed(containers.filter(c => ['packaged', 'devmode'].includes(c.type)));
+ const memoryOther = memoryUsed - memoryProjects;
+ const freeMemory = totalMemory - memoryUsed;
+ const memoryProjectsS = memoryProjects.toFixed(memoryProjects > 10 ? 1 : 1);
+ const memoryOtherS = memoryOther.toFixed(memoryProjects > 10 ? 1 : 1);
+ const freeMemoryS = freeMemory.toFixed(memoryProjects > 10 ? 1 : 1);
+
+ const containerStatuses = containers.filter(p => ['packaged', 'devmode'].includes(p.type));
+ const countTotal = containerStatuses.length;
+ const countRunning = containerStatuses.filter(c => c.state === 'running').length;
+ const countDown = countTotal - countRunning;
+
+ const integrationsCount = projects.filter(p => p.type === ProjectType.integration).length;
+
+ const healthTotal = healths.length;
+ const healthUp = healths.filter(h => h.status === 'UP').length;
+ const healthDown = countRunning - healthUp;
+
+ const routesCount = projectInfos.reduce((sum, i) => sum + (i.routes?.length ?? 0), 0);
+ const routeStateCounts = routes.reduce((acc, c) => {
+ const statusJson = c.statuses?.[0]?.status;
+
+ if (!statusJson) return acc;
+
+ const status = JSON.parse(statusJson);
+ const routeList = status?.route?.routes ?? [];
+
+ for (const r of routeList) {
+ if (!r.state) continue;
+ acc[r.state] = (acc[r.state] ?? 0) + 1;
+ }
+
+ return acc;
+ }, {} as Record<string, number>);
+
+
+ return {
+ totalMemory, memoryUsed, memoryProjects, memoryOther, freeMemory, memoryProjectsS, memoryOtherS, freeMemoryS,
+ countTotal, countRunning, countDown, healthTotal, healthUp, healthDown, fixed, lastUsage,
+ integrationsCount, messagesSucceeded, messagesInflight, messagesFailed, lastFailedExchangeTimestamp, lastFailedTime,
+ routesCount, routeStateCounts
+ }
+}
\ No newline at end of file
diff --git a/karavan-app/src/main/webui/src/ui/stores/ProjectInfoStore.ts b/karavan-app/src/main/webui/src/ui/stores/ProjectInfoStore.ts
new file mode 100644
index 00000000..43517188
--- /dev/null
+++ b/karavan-app/src/main/webui/src/ui/stores/ProjectInfoStore.ts
@@ -0,0 +1,74 @@
+import {BUILD_IN_PROJECTS, ContainerStatus} from "@models/ProjectModels";
+import {KaravanApi} from "@api/KaravanApi";
+import isEqual from "lodash/isEqual";
+import {ProjectInfo, RouteComponentsInfo} from "@models/CatalogModels";
+import {ComplexityApi} from "@features/projects/ComplexityApi";
+import {ComplexityProject} from "@features/projects/ComplexityModels";
+import {createWithEqualityFn} from "zustand/traditional";
+import {shallow} from "zustand/shallow";
+
+
+type OpenApiState = {
+ projectInfos: ProjectInfo[];
+ fetchProjectInfos: () => Promise<void>;
+ setProjectInfos: (projectInfos: ProjectInfo[]) => void;
+}
+
+export const useOpenApiStore = createWithEqualityFn<OpenApiState>((set, get) => ({
+ projectInfos: [],
+ setProjectInfos: (projectInfos: ProjectInfo[]) => {
+ set({projectInfos: projectInfos});
+ },
+ fetchProjectInfos: async (): Promise<void> => {
+ const containerStatusesPromise = new Promise<ContainerStatus[]>((resolve) => {
+ KaravanApi.getAllContainerStatuses((statuses: ContainerStatus[]) => {
+ resolve(statuses);
+ });
+ });
+
+ const complexitiesPromise = new Promise<ComplexityProject[]>((resolve) => {
+ ComplexityApi.getComplexityProjects((complexities) => {
+ resolve(complexities);
+ });
+ });
+
+ // Wait for BOTH API calls
+ const [containers, complexities] = await Promise.all([
+ containerStatusesPromise,
+ complexitiesPromise
+ ]);
+ const currenProjectInfos = get().projectInfos;
+ const projectInfos: ProjectInfo[] = [];
+ complexities.filter(c => !BUILD_IN_PROJECTS.includes(c.type)).forEach(c => {
+ const routes: RouteComponentsInfo[] = []
+ c.routes.forEach(r => {
+ routes.push({
+ routeId: r.routeId,
+ nodePrefixId: r.nodePrefixId,
+ fileName: r.fileName,
+ consumers: r.consumers,
+ producers: r.producers,
+ routeTemplateRef: r.routeTemplateRef,
+ isTemplated: r.isTemplated
+ })
+ })
+ const isDevModeRunning = containers.filter(cs => cs.projectId === c.projectId && cs.type === 'devmode')?.at(0)?.state === "running"
+ const isPackagedRunning = containers.filter(cs => cs.projectId === c.projectId && cs.type === 'packaged')?.at(0)?.state === "running"
+ const isBuildRunning = containers.filter(cs => cs.projectId === c.projectId && cs.type === 'build')?.at(0)?.state === "running"
+ const implementsAsyncApi = c.files.filter(f => f.generated).length > 0;
+ projectInfos.push({
+ projectId: c.projectId,
+ isDevModeRunning: isDevModeRunning,
+ isPackagedRunning: isPackagedRunning,
+ isBuildRunning: isBuildRunning,
+ routes: routes,
+ exposesOpenApi: c.exposesOpenApi,
+ implementsAsyncApi: implementsAsyncApi
+ })
+ });
+
+ if (!isEqual(currenProjectInfos, projectInfos)) {
+ set({ projectInfos: projectInfos });
+ }
+ },
+}), shallow)