diff --git a/karavan-app/src/main/resources/application.properties b/karavan-app/src/main/resources/application.properties index c29b6e1591b..034493520c5 100644 --- a/karavan-app/src/main/resources/application.properties +++ b/karavan-app/src/main/resources/application.properties @@ -41,7 +41,7 @@ karavan.keycloak.backend.secret=karavan # Git repository Configuration karavan.git.repository=http://gitea:3000/karavan/karavan.git karavan.git.username=karavan -karavan.git.password=karavan +karavan.git.password=karavankaravan karavan.git.branch=main karavan.private-key-path= @@ -99,6 +99,8 @@ quarkus.kubernetes-client.devservices.enabled=false %public.quarkus.swagger-ui.always-include=true quarkus.quinoa.ci=false +quarkus.quinoa.package-manager-install=true +quarkus.quinoa.package-manager-install.node-version=22.9.0 quarkus.quinoa.dev-server.port=3003 quarkus.quinoa.dev-server.check-timeout=60000 quarkus.quinoa.ignored-path-prefixes=/ui,/public diff --git a/karavan-app/src/main/resources/configuration/docker/devservices.docker-compose.yaml b/karavan-app/src/main/resources/services/docker/docker-compose.yaml similarity index 100% rename from karavan-app/src/main/resources/configuration/docker/devservices.docker-compose.yaml rename to karavan-app/src/main/resources/services/docker/docker-compose.yaml diff --git a/karavan-app/src/main/webui/src/api/ProjectModels.ts b/karavan-app/src/main/webui/src/api/ProjectModels.ts index f6b41e491a3..85c22de0757 100644 --- a/karavan-app/src/main/webui/src/api/ProjectModels.ts +++ b/karavan-app/src/main/webui/src/api/ProjectModels.ts @@ -30,10 +30,12 @@ export enum ProjectType { templates ='templates', kamelets ='kamelets', configuration ='configuration', + services ='services', normal ='normal', } -export const BUILD_IN_PROJECTS: string[] = [ProjectType.kamelets.toString(), ProjectType.templates.toString(), ProjectType.configuration.toString()]; +export const BUILD_IN_PROJECTS: string[] = [ProjectType.kamelets.toString(), ProjectType.templates.toString(), ProjectType.configuration.toString(), ProjectType.services.toString()]; +export const RESERVED_WORDS: string[] = [...BUILD_IN_PROJECTS, 'karavan']; export class Project { projectId: string = ''; @@ -68,6 +70,7 @@ export class DeploymentStatus { replicas: number = 0; readyReplicas: number = 0; unavailableReplicas: number = 0; + type: 'devmode' | 'devservice' | 'project' | 'internal' | 'build' | 'unknown' = 'unknown'; } export class ServiceStatus { @@ -105,7 +108,7 @@ export class ContainerStatus { ports: ContainerPort [] = []; commands: string [] = []; inTransit: boolean = false; - camelRuntime: string = '' + labels: any public constructor(init?: Partial) { Object.assign(this, init); diff --git a/karavan-app/src/main/webui/src/config/ConfigurationPage.tsx b/karavan-app/src/main/webui/src/config/SystemPage.tsx similarity index 96% rename from karavan-app/src/main/webui/src/config/ConfigurationPage.tsx rename to karavan-app/src/main/webui/src/config/SystemPage.tsx index 18bd909c56e..9337582265b 100644 --- a/karavan-app/src/main/webui/src/config/ConfigurationPage.tsx +++ b/karavan-app/src/main/webui/src/config/SystemPage.tsx @@ -33,7 +33,7 @@ interface Props { dark: boolean, } -export const ConfigurationPage = (props: Props) => { +export const SystemPage = (props: Props) => { const [tab, setTab] = useState("statuses"); @@ -62,7 +62,7 @@ export const ConfigurationPage = (props: Props) => { function title() { return ( - Configuration + System ); } diff --git a/karavan-app/src/main/webui/src/project/dashboard/InfoContainer.tsx b/karavan-app/src/main/webui/src/log/InfoTabContainer.tsx similarity index 96% rename from karavan-app/src/main/webui/src/project/dashboard/InfoContainer.tsx rename to karavan-app/src/main/webui/src/log/InfoTabContainer.tsx index b6a5b392313..3b2e5fe12ab 100644 --- a/karavan-app/src/main/webui/src/project/dashboard/InfoContainer.tsx +++ b/karavan-app/src/main/webui/src/log/InfoTabContainer.tsx @@ -24,17 +24,15 @@ import { DescriptionListTerm, Label, } from '@patternfly/react-core'; -import '../../designer/karavan.css'; import DownIcon from "@patternfly/react-icons/dist/esm/icons/error-circle-o-icon"; import UpIcon from "@patternfly/react-icons/dist/esm/icons/check-circle-icon"; -import {ContainerStatus} from "../../api/ProjectModels"; - +import {ContainerStatus} from "../api/ProjectModels"; interface Props { containerStatus: ContainerStatus, } -export function InfoContainer (props: Props) { +export function InfoTabContainer (props: Props) { function getPodInfoLabel(info: React.ReactNode) { return ( diff --git a/karavan-app/src/main/webui/src/project/dashboard/InfoContext.tsx b/karavan-app/src/main/webui/src/log/InfoTabContext.tsx similarity index 97% rename from karavan-app/src/main/webui/src/project/dashboard/InfoContext.tsx rename to karavan-app/src/main/webui/src/log/InfoTabContext.tsx index 33795e8da2e..caa2c16970a 100644 --- a/karavan-app/src/main/webui/src/project/dashboard/InfoContext.tsx +++ b/karavan-app/src/main/webui/src/log/InfoTabContext.tsx @@ -24,19 +24,17 @@ import { Label, LabelGroup, Tooltip } from '@patternfly/react-core'; -import '../../designer/karavan.css'; import DownIcon from "@patternfly/react-icons/dist/esm/icons/error-circle-o-icon"; import UpIcon from "@patternfly/react-icons/dist/esm/icons/check-circle-icon"; -import {ContainerStatus} from "../../api/ProjectModels"; -import {useProjectStore} from "../../api/ProjectStore"; import {shallow} from "zustand/shallow"; - +import {useProjectStore} from "../api/ProjectStore"; +import {ContainerStatus} from "../api/ProjectModels"; interface Props { containerStatus: ContainerStatus } -export function InfoContext (props: Props) { +export function InfoTabContext (props: Props) { const [camelStatuses] = useProjectStore((state) => [state.camelStatuses], shallow); const camelStatus = camelStatuses.filter(s => s.containerName === props.containerStatus.containerName).at(0); diff --git a/karavan-app/src/main/webui/src/project/dashboard/InfoMemory.tsx b/karavan-app/src/main/webui/src/log/InfoTabMemory.tsx similarity index 96% rename from karavan-app/src/main/webui/src/project/dashboard/InfoMemory.tsx rename to karavan-app/src/main/webui/src/log/InfoTabMemory.tsx index 689d904caca..2b345483184 100644 --- a/karavan-app/src/main/webui/src/project/dashboard/InfoMemory.tsx +++ b/karavan-app/src/main/webui/src/log/InfoTabMemory.tsx @@ -24,19 +24,17 @@ import { Label, LabelGroup, Tooltip } from '@patternfly/react-core'; -import '../../designer/karavan.css'; import DownIcon from "@patternfly/react-icons/dist/esm/icons/error-circle-o-icon"; import UpIcon from "@patternfly/react-icons/dist/esm/icons/check-circle-icon"; -import {ContainerStatus} from "../../api/ProjectModels"; -import {useProjectStore} from "../../api/ProjectStore"; import {shallow} from "zustand/shallow"; - +import {useProjectStore} from "../api/ProjectStore"; +import { ContainerStatus } from '../api/ProjectModels'; interface Props { containerStatus: ContainerStatus } -export function InfoMemory (props: Props) { +export function InfoTabMemory (props: Props) { const [camelStatuses] = useProjectStore((state) => [state.camelStatuses], shallow); diff --git a/karavan-app/src/main/webui/src/project/dashboard/DashboardTab.tsx b/karavan-app/src/main/webui/src/log/InformationLog.tsx similarity index 71% rename from karavan-app/src/main/webui/src/project/dashboard/DashboardTab.tsx rename to karavan-app/src/main/webui/src/log/InformationLog.tsx index 3bdffeade39..9f70a6e331c 100644 --- a/karavan-app/src/main/webui/src/project/dashboard/DashboardTab.tsx +++ b/karavan-app/src/main/webui/src/log/InformationLog.tsx @@ -14,60 +14,61 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React, {useEffect} from 'react'; +import React from 'react'; import { Card, CardBody, Flex, FlexItem, Divider, - PageSection, EmptyState, EmptyStateVariant, EmptyStateHeader, EmptyStateIcon, Bullseye } from '@patternfly/react-core'; -import '../../designer/karavan.css'; -import {InfoContainer} from "./InfoContainer"; -import {InfoContext} from "./InfoContext"; -import {InfoMemory} from "./InfoMemory"; -import {useProjectStore, useStatusesStore} from "../../api/ProjectStore"; +import {InfoTabContainer} from "./InfoTabContainer"; +import {InfoTabContext} from "./InfoTabContext"; +import {InfoTabMemory} from "./InfoTabMemory"; import {shallow} from "zustand/shallow"; import SearchIcon from "@patternfly/react-icons/dist/esm/icons/search-icon"; +import {useStatusesStore} from "../api/ProjectStore"; -export function DashboardTab() { +interface Props { + currentPodName: string + header?: React.ReactNode +} - const [project] = useProjectStore((state) => [state.project], shallow); - const [containers] = useStatusesStore((state) => [state.containers], shallow); +export function InformationLog(props: Props): JSX.Element { - const camelContainers = containers - .filter(c => c.projectId === project.projectId && ['devmode', 'project'].includes(c.type)); + const [containers] = useStatusesStore((state) => [state.containers], shallow); + const camelContainers = containers.filter(cs => cs.containerName === props.currentPodName); return ( - +
+ {props.header} {camelContainers.map((containerStatus, index) => - + - + - + - + )} {camelContainers.length === 0 && - + @@ -78,6 +79,6 @@ export function DashboardTab() { } - +
) } diff --git a/karavan-app/src/main/webui/src/log/ProjectLogPanel.tsx b/karavan-app/src/main/webui/src/log/ProjectLogPanel.tsx index 42ecea1ce47..f660cdd65ec 100644 --- a/karavan-app/src/main/webui/src/log/ProjectLogPanel.tsx +++ b/karavan-app/src/main/webui/src/log/ProjectLogPanel.tsx @@ -1,46 +1,44 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - import React, {useEffect, useState} from 'react'; -import {Button, Checkbox, Label, PageSection, Tooltip, TooltipPosition} from '@patternfly/react-core'; +import { + Button, + Checkbox, + Label, + PageSection, ToggleGroup, ToggleGroupItem, + Tooltip, + TooltipPosition +} from '@patternfly/react-core'; import './ProjectLog.css'; import CloseIcon from '@patternfly/react-icons/dist/esm/icons/times-icon'; import ExpandIcon from '@patternfly/react-icons/dist/esm/icons/expand-icon'; import CollapseIcon from '@patternfly/react-icons/dist/esm/icons/compress-icon'; import CleanIcon from '@patternfly/react-icons/dist/esm/icons/trash-alt-icon'; -import {useLogStore} from "../api/ProjectStore"; +import {useAppConfigStore, useLogStore, useProjectStore, useStatusesStore} from "../api/ProjectStore"; import {shallow} from "zustand/shallow"; import {ProjectEventBus} from "../api/ProjectEventBus"; import {ProjectLog} from "./ProjectLog"; import {LogWatchApi} from "../api/LogWatchApi"; +import {InformationLog} from "./InformationLog"; +import {ProjectService} from "../api/ProjectService"; const INITIAL_LOG_HEIGHT = "50%"; -export function ProjectLogPanel () { +export function ProjectLogPanel() { + + const [config] = useAppConfigStore((state) => [state.config], shallow); + const [project] = useProjectStore((s) => [s.project], shallow); + const [containers] = useStatusesStore((state) => [state.containers], shallow); const [showLog, type, setShowLog, podName] = useLogStore( (state) => [state.showLog, state.type, state.setShowLog, state.podName], shallow) const [height, setHeight] = useState(INITIAL_LOG_HEIGHT); const [isTextWrapped, setIsTextWrapped] = useState(true); const [autoScroll, setAutoScroll] = useState(true); - const [controller, setController] = React.useState(new AbortController()); const [currentPodName, setCurrentPodName] = useState(undefined); + const [tab, setTab] = useState<'log' | 'events' | 'main-configuration' | 'info'>('log'); + const [controller, setController] = React.useState(new AbortController()); useEffect(() => { + setTab('log'); controller.abort() const c = new AbortController(); setController(c); @@ -61,39 +59,58 @@ export function ProjectLogPanel () { } }, [podName]); + useEffect(() => { + const interval = setInterval(() => refreshData(), 1300) + return () => clearInterval(interval); + }, [tab]); + + function refreshData(){ + if (tab === 'info') { + ProjectService.refreshCamelStatus(project.projectId, config.environment); + } + } + function getButtons() { - return (
- - -
); + setShowLog(false, 'none'); + setHeight(INITIAL_LOG_HEIGHT); + ProjectEventBus.sendLog('set', '') + }} icon={}/> + + ); } return (showLog ? - + {tab === 'log' && } + {tab === 'info' && currentPodName && } : <>); } diff --git a/karavan-app/src/main/webui/src/main/KnowledgebaseWrapper.tsx b/karavan-app/src/main/webui/src/main/HelpWrapper.tsx similarity index 97% rename from karavan-app/src/main/webui/src/main/KnowledgebaseWrapper.tsx rename to karavan-app/src/main/webui/src/main/HelpWrapper.tsx index 8224c2edb88..f6c085701e3 100644 --- a/karavan-app/src/main/webui/src/main/KnowledgebaseWrapper.tsx +++ b/karavan-app/src/main/webui/src/main/HelpWrapper.tsx @@ -25,7 +25,7 @@ import { ProjectService } from "../api/ProjectService"; interface Props { dark: boolean, } -export const KnowledgebaseWrapper = (props: Props) => { +export const HelpWrapper = (props: Props) => { const [blockList, setBlockList] = useState(); diff --git a/karavan-app/src/main/webui/src/main/MainRoutes.tsx b/karavan-app/src/main/webui/src/main/MainRoutes.tsx index adb8b4acef2..835b6d5a150 100644 --- a/karavan-app/src/main/webui/src/main/MainRoutes.tsx +++ b/karavan-app/src/main/webui/src/main/MainRoutes.tsx @@ -22,8 +22,8 @@ import {ProjectPage} from "../project/ProjectPage"; import {ServicesPage} from "../services/ServicesPage"; import {ContainersPage} from "../containers/ContainersPage"; import {ResourcesPage} from "../resources/ResourcesPage"; -import {ConfigurationPage} from "../config/ConfigurationPage"; -import { KnowledgebaseWrapper } from './KnowledgebaseWrapper'; +import {SystemPage} from "../config/SystemPage"; +import { HelpWrapper } from './HelpWrapper'; export function MainRoutes() { @@ -34,8 +34,8 @@ export function MainRoutes() { }/> }/> }/> - }/> - }/> + }/> + }/> }/> ) diff --git a/karavan-app/src/main/webui/src/project/ProjectPage.tsx b/karavan-app/src/main/webui/src/project/ProjectPage.tsx index 06537f5fcb2..64094088cc0 100644 --- a/karavan-app/src/main/webui/src/project/ProjectPage.tsx +++ b/karavan-app/src/main/webui/src/project/ProjectPage.tsx @@ -107,7 +107,6 @@ export function ProjectPage() { }}> {} - {} {} {showBuildTab && } diff --git a/karavan-app/src/main/webui/src/project/ProjectPanel.tsx b/karavan-app/src/main/webui/src/project/ProjectPanel.tsx index d33d4d41c08..f7db03656ac 100644 --- a/karavan-app/src/main/webui/src/project/ProjectPanel.tsx +++ b/karavan-app/src/main/webui/src/project/ProjectPanel.tsx @@ -23,7 +23,6 @@ import { import '../designer/karavan.css'; import {FilesTab} from "./files/FilesTab"; import {useAppConfigStore, useFilesStore, useFileStore, useProjectStore, useWizardStore} from "../api/ProjectStore"; -import {DashboardTab} from "./dashboard/DashboardTab"; import {TraceTab} from "./trace/TraceTab"; import {ProjectBuildTab} from "./builder/ProjectBuildTab"; import {ProjectService} from "../api/ProjectService"; @@ -102,7 +101,6 @@ export function ProjectPanel() { {tab === 'files' && } - {!buildIn && tab === 'dashboard' && project && } {!buildIn && tab === 'trace' && project && } {!buildIn && tab === 'build' && } {!buildIn && tab === 'build' && config.infrastructure !== 'kubernetes' && diff --git a/karavan-app/src/main/webui/src/services/ServicesPage.tsx b/karavan-app/src/main/webui/src/services/ServicesPage.tsx index 4c073e14c8b..835f8893c4f 100644 --- a/karavan-app/src/main/webui/src/services/ServicesPage.tsx +++ b/karavan-app/src/main/webui/src/services/ServicesPage.tsx @@ -33,13 +33,13 @@ import { import '../designer/karavan.css'; import RefreshIcon from '@patternfly/react-icons/dist/esm/icons/sync-alt-icon'; import { - Td, - Th, - Thead, - Tr + Td, + Th, + Thead, + Tr } from '@patternfly/react-table'; import { - Table + Table } from '@patternfly/react-table/deprecated'; import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon'; import {ServicesTableRow} from "./ServicesTableRow"; @@ -68,8 +68,8 @@ export function ServicesPage () { }, []); function getServices() { - KaravanApi.getFiles(ProjectType.configuration.toString(), files => { - const file = files.filter(f => f.name === 'devservices.docker-compose.yaml').at(0); + KaravanApi.getFiles(ProjectType.services.toString(), files => { + const file = files.filter(f => f.name === 'docker-compose.yaml').at(0); if (file) { const services: DockerCompose = ServicesYaml.yamlToServices(file.code); setServices(services);