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 2023/12/18 19:47:27 UTC
(camel-karavan) 02/02: Fix #1036
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 77ea9ae5a1f225ad617c236969ffdf5ff73bbb88
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Mon Dec 18 14:47:17 2023 -0500
Fix #1036
---
karavan-designer/src/designer/KaravanDesigner.tsx | 3 ++-
karavan-designer/src/designer/beans/BeansDesigner.tsx | 12 +++++++++---
karavan-designer/src/designer/rest/RestDesigner.tsx | 13 ++++++++++---
karavan-designer/src/designer/route/RouteDesigner.tsx | 4 +++-
4 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/karavan-designer/src/designer/KaravanDesigner.tsx b/karavan-designer/src/designer/KaravanDesigner.tsx
index 7e56de60..626f984b 100644
--- a/karavan-designer/src/designer/KaravanDesigner.tsx
+++ b/karavan-designer/src/designer/KaravanDesigner.tsx
@@ -41,6 +41,7 @@ import {BeansDesigner} from "./beans/BeansDesigner";
import {CodeEditor} from "./editor/CodeEditor";
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
import {KameletDesigner} from "./kamelet/KameletDesigner";
+import {v4 as uuidv4} from "uuid";
interface Props {
onSave: (filename: string, yaml: string, propertyOnly: boolean) => void
@@ -75,9 +76,9 @@ export function KaravanDesigner(props: Props) {
let designerTab = i.kind === 'Kamelet' ? 'kamelet' : props.tab;
if (designerTab === undefined) {
const counts = CamelUi.getFlowCounts(i);
+ designerTab = (counts.get('routes') || 0) > 0 ? 'routes' : designerTab;
designerTab = (counts.get('rest') || 0) > 0 ? 'rest' : designerTab;
designerTab = (counts.get('beans') || 0) > 0 ? 'beans' : designerTab;
- designerTab = (counts.get('routes') || 0) > 0 ? 'routes' : designerTab;
}
setTab(designerTab || 'routes')
reset();
diff --git a/karavan-designer/src/designer/beans/BeansDesigner.tsx b/karavan-designer/src/designer/beans/BeansDesigner.tsx
index 2e7b67e0..ceca2c21 100644
--- a/karavan-designer/src/designer/beans/BeansDesigner.tsx
+++ b/karavan-designer/src/designer/beans/BeansDesigner.tsx
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import React from 'react';
+import React, {useEffect} from 'react';
import {
Button,
Drawer,
@@ -39,9 +39,15 @@ import {shallow} from "zustand/shallow";
export function BeansDesigner() {
const [integration, setIntegration] = useIntegrationStore((s) => [s.integration, s.setIntegration], shallow)
- const [dark, selectedStep, showDeleteConfirmation, setShowDeleteConfirmation, setSelectedStep] = useDesignerStore((s) =>
- [s.dark, s.selectedStep, s.showDeleteConfirmation, s.setShowDeleteConfirmation, s.setSelectedStep], shallow)
+ const [dark, selectedStep, showDeleteConfirmation, setShowDeleteConfirmation, setSelectedStep, setNotification]
+ = useDesignerStore((s) =>
+ [s.dark, s.selectedStep, s.showDeleteConfirmation, s.setShowDeleteConfirmation, s.setSelectedStep, s.setNotification], shallow)
+ useEffect(() => {
+ return () => {
+ setNotification(false, ['', '']);
+ }
+ }, []);
function onShowDeleteConfirmation(bean: RegistryBeanDefinition) {
setSelectedStep(bean);
diff --git a/karavan-designer/src/designer/rest/RestDesigner.tsx b/karavan-designer/src/designer/rest/RestDesigner.tsx
index 51ce51af..303e6bb8 100644
--- a/karavan-designer/src/designer/rest/RestDesigner.tsx
+++ b/karavan-designer/src/designer/rest/RestDesigner.tsx
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import React from 'react';
+import React, {useEffect} from 'react';
import {
Button, Drawer, DrawerContent, DrawerContentBody, DrawerPanelContent, Flex, FlexItem, Gallery, GalleryItem, Modal,
PageSection
@@ -43,11 +43,18 @@ import {shallow} from "zustand/shallow";
export function RestDesigner() {
const [integration, setIntegration] = useIntegrationStore((state) => [state.integration, state.setIntegration], shallow)
- const [dark, selectedStep, showDeleteConfirmation, setShowDeleteConfirmation, setPosition, width, height, top, left, hideLogDSL, setSelectedStep] = useDesignerStore((s) =>
- [s.dark, s.selectedStep, s.showDeleteConfirmation, s.setShowDeleteConfirmation, s.setPosition, s.width, s.height, s.top, s.left, s.hideLogDSL, s.setSelectedStep], shallow)
+ const [selectedStep, showDeleteConfirmation, setShowDeleteConfirmation, setSelectedStep, setNotification]
+ = useDesignerStore((s) =>
+ [s.selectedStep, s.showDeleteConfirmation, s.setShowDeleteConfirmation, s.setSelectedStep, s.setNotification], shallow)
const [showSelector, setShowSelector] = useSelectorStore((s) => [s.showSelector, s.setShowSelector], shallow)
+ useEffect(() => {
+ return () => {
+ setNotification(false, ['', '']);
+ }
+ }, []);
+
function selectElement(element: CamelElement) {
setSelectedStep(element);
}
diff --git a/karavan-designer/src/designer/route/RouteDesigner.tsx b/karavan-designer/src/designer/route/RouteDesigner.tsx
index b02ed20b..3719d3c6 100644
--- a/karavan-designer/src/designer/route/RouteDesigner.tsx
+++ b/karavan-designer/src/designer/route/RouteDesigner.tsx
@@ -60,7 +60,9 @@ export function RouteDesigner() {
if (flowRef && flowRef.current) {
const el = flowRef.current;
const rect = el.getBoundingClientRect();
- setPosition(rect.width, rect.height, rect.top, rect.left)
+ if (width !== rect.width || height !== rect.height || top !== rect.top || left !== rect.left) {
+ setPosition(rect.width, rect.height, rect.top, rect.left)
+ }
}
}