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 9da66aece72725b101fb19a60cb304a020e06d74 Author: Marat Gubaidullin <ma...@talismancloud.io> AuthorDate: Mon Jul 15 19:03:26 2024 -0400 Fix --- .../main/webui/src/designer/utils/Notification.tsx | 2 +- .../src/knowledgebase/components/ComponentCard.tsx | 25 ++++++++-------------- karavan-space/src/designer/utils/Notification.tsx | 2 +- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/karavan-app/src/main/webui/src/designer/utils/Notification.tsx b/karavan-app/src/main/webui/src/designer/utils/Notification.tsx index 1f435c4b..ae8ebd54 100644 --- a/karavan-app/src/main/webui/src/designer/utils/Notification.tsx +++ b/karavan-app/src/main/webui/src/designer/utils/Notification.tsx @@ -45,7 +45,7 @@ export function Notification () { <AlertGroup isToast isLiveRegion> {alerts.map((e: ToastMessage) => ( <Alert key={e.id} className="main-alert" variant={e.variant} title={e.title} - timeout={['success', 'info', 'custom'].includes(e.variant) ? 1000 : 20000} + timeout={['success', 'info', 'custom'].includes(e.variant) ? 2300 : 20000} actionClose={<AlertActionCloseButton onClose={() => { setAlerts(prevState => { return [...prevState.filter(t => t.id !== e.id)]; diff --git a/karavan-app/src/main/webui/src/knowledgebase/components/ComponentCard.tsx b/karavan-app/src/main/webui/src/knowledgebase/components/ComponentCard.tsx index c9f39d04..8794ef1e 100644 --- a/karavan-app/src/main/webui/src/knowledgebase/components/ComponentCard.tsx +++ b/karavan-app/src/main/webui/src/knowledgebase/components/ComponentCard.tsx @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React, {useEffect, useState} from 'react'; +import React, { useEffect, useState } from 'react'; import { CardHeader, Card, CardTitle, CardBody, CardFooter, Badge, Checkbox, Flex } from '@patternfly/react-core'; @@ -23,7 +23,7 @@ import {CamelUi} from "../../designer/utils/CamelUi"; import {Component} from "karavan-core/lib/model/ComponentModels"; import {useKnowledgebaseStore} from "../KnowledgebaseStore"; import {shallow} from "zustand/shallow"; -import {ComponentApi} from 'karavan-core/lib/api/ComponentApi'; +import { ComponentApi } from 'karavan-core/lib/api/ComponentApi'; interface Props { component: Component, @@ -39,39 +39,32 @@ export function ComponentCard(props: Props) { useEffect(() => { setBlockedComponents(ComponentApi.getBlockedComponentNames()); }, []); - + function click(event: React.MouseEvent) { - const {target} = event; + const { target } = event; if (!(target as HTMLElement).parentElement?.className.includes("block-checkbox")) { setComponent(component) setModalOpen(true); } } - function selectComponent(event: React.FormEvent, checked: boolean) { props.onChange(component.component.name, checked); - setBlockedComponents([...ComponentApi.getBlockedComponentNames()]); + setBlockedComponents([...ComponentApi.getBlockedComponentNames()]); } - const isBlockedComponent = blockedComponents ? blockedComponents.findIndex(r => r === component.component.name) > -1 : false; - const isRemote = component.component.remote; + const isRemote = component.component.remote; return ( <Card isCompact key={component.component.name} className="kamelet-card" onClick={event => click(event)} > <CardHeader className="header-labels"> - <Flex style={{width: '100%'}} gap={{default: 'gapSm'}} justifyContent={{default: 'justifyContentSpaceBetween'}}> + <Flex style={{width:'100%'}} gap={{default:'gapSm'}} justifyContent={{default: 'justifyContentSpaceBetween'}}> <Badge isRead className="support-level labels">{component.component.supportLevel}</Badge> <Badge isRead className="version labels">{component.component.version}</Badge> </Flex> - {showBlockCheckbox && - <Checkbox id={component.component.name} - className="block-checkbox labels" - isChecked={!isBlockedComponent} - onChange={(_, checked) => selectComponent(_, checked)} - /> - } + {showBlockCheckbox && <Checkbox id={component.component.name} className="block-checkbox labels" + isChecked={!isBlockedComponent} onChange={(_, checked) => selectComponent(_, checked)}/>} </CardHeader> <CardHeader> {CamelUi.getIconForComponent(component.component.title, component.component.label)} diff --git a/karavan-space/src/designer/utils/Notification.tsx b/karavan-space/src/designer/utils/Notification.tsx index 1f435c4b..ae8ebd54 100644 --- a/karavan-space/src/designer/utils/Notification.tsx +++ b/karavan-space/src/designer/utils/Notification.tsx @@ -45,7 +45,7 @@ export function Notification () { <AlertGroup isToast isLiveRegion> {alerts.map((e: ToastMessage) => ( <Alert key={e.id} className="main-alert" variant={e.variant} title={e.title} - timeout={['success', 'info', 'custom'].includes(e.variant) ? 1000 : 20000} + timeout={['success', 'info', 'custom'].includes(e.variant) ? 2300 : 20000} actionClose={<AlertActionCloseButton onClose={() => { setAlerts(prevState => { return [...prevState.filter(t => t.id !== e.id)];