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/04/24 20:15:25 UTC
[camel-karavan] 02/02: Karavan space up to date
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 386ae14dd1946b07f7b3627a363b3f3295654555
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Mon Apr 24 16:15:13 2023 -0400
Karavan space up to date
---
karavan-space/package-lock.json | 6 ++--
karavan-space/src/components/ComponentCard.tsx | 2 +-
.../src/designer/route/DslConnections.tsx | 7 ++---
.../src/designer/route/RouteDesignerLogic.tsx | 3 +-
.../route/property/ComponentParameterField.tsx | 32 ++++++++++++++++------
.../designer/route/property/DslPropertyField.tsx | 2 +-
karavan-space/src/designer/utils/CamelUi.tsx | 1 +
7 files changed, 34 insertions(+), 19 deletions(-)
diff --git a/karavan-space/package-lock.json b/karavan-space/package-lock.json
index 02882814..a4ab32fc 100644
--- a/karavan-space/package-lock.json
+++ b/karavan-space/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "karavan-space",
- "version": "3.20.1",
+ "version": "3.20.2-SNAPSHOT",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "karavan-space",
- "version": "3.20.1",
+ "version": "3.20.2-SNAPSHOT",
"license": "Apache-2.0",
"dependencies": {
"@monaco-editor/react": "4.4.6",
@@ -43,7 +43,7 @@
}
},
"../karavan-core": {
- "version": "3.20.1-SNAPSHOT",
+ "version": "3.20.2-SNAPSHOT",
"license": "Apache-2.0",
"dependencies": {
"@types/js-yaml": "^4.0.5",
diff --git a/karavan-space/src/components/ComponentCard.tsx b/karavan-space/src/components/ComponentCard.tsx
index c2a07924..9305a086 100644
--- a/karavan-space/src/components/ComponentCard.tsx
+++ b/karavan-space/src/components/ComponentCard.tsx
@@ -16,7 +16,7 @@
*/
import React from 'react';
import {
- CardHeader, Card, CardTitle, CardBody, CardFooter, Badge, Text
+ CardHeader, Card, CardTitle, CardBody, CardFooter, Badge
} from '@patternfly/react-core';
import '../designer/karavan.css';
import {camelIcon, CamelUi} from "../designer/utils/CamelUi";
diff --git a/karavan-space/src/designer/route/DslConnections.tsx b/karavan-space/src/designer/route/DslConnections.tsx
index 6dc1ced3..f18866e1 100644
--- a/karavan-space/src/designer/route/DslConnections.tsx
+++ b/karavan-space/src/designer/route/DslConnections.tsx
@@ -32,7 +32,6 @@ interface Props {
interface State {
integration: Integration
- sub?: Subscription
steps: Map<string, DslPosition>
}
@@ -46,14 +45,14 @@ export class DslConnections extends React.Component<Props, State> {
integration: this.props.integration,
steps: new Map<string, DslPosition>(),
};
+ sub?: Subscription;
componentDidMount() {
- const sub = EventBus.onPosition()?.subscribe((evt: DslPosition) => this.setPosition(evt));
- this.setState({sub: sub});
+ this.sub = EventBus.onPosition()?.subscribe((evt: DslPosition) => this.setPosition(evt));
}
componentWillUnmount() {
- this.state.sub?.unsubscribe();
+ this.sub?.unsubscribe();
}
setPosition(evt: DslPosition) {
diff --git a/karavan-space/src/designer/route/RouteDesignerLogic.tsx b/karavan-space/src/designer/route/RouteDesignerLogic.tsx
index 92d1f414..7dc03980 100644
--- a/karavan-space/src/designer/route/RouteDesignerLogic.tsx
+++ b/karavan-space/src/designer/route/RouteDesignerLogic.tsx
@@ -301,7 +301,8 @@ export class RouteDesignerLogic {
setDslDefaults(step: CamelElement): CamelElement {
if (step.dslName === 'LogDefinition') {
- (step as LogDefinition).message = '${body}'
+ // eslint-disable-next-line no-template-curly-in-string
+ (step as LogDefinition).message = "${body}";
}
if (step.dslName === 'ChoiceDefinition') {
(step as ChoiceDefinition).when?.push(CamelDefinitionApi.createStep('WhenDefinition', undefined));
diff --git a/karavan-space/src/designer/route/property/ComponentParameterField.tsx b/karavan-space/src/designer/route/property/ComponentParameterField.tsx
index 67dd8165..faad51c8 100644
--- a/karavan-space/src/designer/route/property/ComponentParameterField.tsx
+++ b/karavan-space/src/designer/route/property/ComponentParameterField.tsx
@@ -39,6 +39,7 @@ import {KubernetesAPI} from "../../utils/KubernetesAPI";
import KubernetesIcon from "@patternfly/react-icons/dist/js/icons/openshift-icon";
import ShowIcon from "@patternfly/react-icons/dist/js/icons/eye-icon";
import HideIcon from "@patternfly/react-icons/dist/js/icons/eye-slash-icon";
+import PlusIcon from "@patternfly/react-icons/dist/esm/icons/plus-icon";
const prefix = "parameters";
const beanPrefix = "#bean:";
@@ -131,12 +132,17 @@ export class ComponentParameterField extends React.Component<Props, State> {
getInternalUriSelect = (property: ComponentProperty, value: any) => {
const selectOptions: JSX.Element[] = [];
const componentName = this.getInternalComponentName(property);
- const urls = CamelUi.getInternalRouteUris(this.props.integration, componentName, false);
- if (urls && urls.length > 0) {
- selectOptions.push(...urls.map((value: string) =>
+ const internalUris = CamelUi.getInternalRouteUris(this.props.integration, componentName, false);
+ const uris: string [] = [];
+ uris.push(...internalUris);
+ if (value.length > 0 && !uris.includes(value)) {
+ uris.unshift(value);
+ }
+ if (uris && uris.length > 0) {
+ selectOptions.push(...uris.map((value: string) =>
<SelectOption key={value} value={value.trim()}/>));
}
- return (
+ return <InputGroup>
<Select
placeholderText="Select or type an URI"
variant={SelectVariant.typeahead}
@@ -145,19 +151,27 @@ export class ComponentParameterField extends React.Component<Props, State> {
this.openSelect(property.name, isExpanded)
}}
onSelect={(e, value, isPlaceholder) => {
- const newRoute = !urls.includes(value.toString()) ? new RouteToCreate(componentName, value.toString()) : undefined;
- this.parametersChanged(property.name, (!isPlaceholder ? value : undefined), property.kind === 'path', newRoute);
+ this.parametersChanged(property.name, (!isPlaceholder ? value : undefined), property.kind === 'path', undefined);
}}
selections={value}
isOpen={this.isSelectOpen(property.name)}
isCreatable={true}
+ createText=""
isInputFilterPersisted={true}
aria-labelledby={property.name}
direction={SelectDirection.down}
>
{selectOptions}
</Select>
- )
+ <Tooltip position="bottom-end" content={"Create route"}>
+ <Button variant="control" onClick={e => {
+ const newRoute = !internalUris.includes(value.toString()) ? new RouteToCreate(componentName, value.toString()) : undefined;
+ this.parametersChanged(property.name, value, property.kind === 'path', newRoute);
+ }}>
+ {<PlusIcon/>}
+ </Button>
+ </Tooltip>
+ </InputGroup>
}
selectKubernetes = (value: string) => {
@@ -280,7 +294,7 @@ export class ComponentParameterField extends React.Component<Props, State> {
id={id} name={id}
value={value?.toString()}
aria-label={id}
- isChecked={value !== undefined ? Boolean(value) === true : property.defaultValue !== undefined && property.defaultValue === 'true'}
+ isChecked={value !== undefined ? Boolean(value) : property.defaultValue !== undefined && property.defaultValue === 'true'}
onChange={e => this.parametersChanged(property.name, !Boolean(value))}/>
)
}
@@ -303,7 +317,7 @@ export class ComponentParameterField extends React.Component<Props, State> {
footerContent={
<div>
{property.defaultValue !== undefined && <div>{"Default: " + property.defaultValue}</div>}
- {property.required === true && <div>{property.displayName + " is required"}</div>}
+ {property.required && <div>{property.displayName + " is required"}</div>}
</div>
}>
<button type="button" aria-label="More info" onClick={e => e.preventDefault()}
diff --git a/karavan-space/src/designer/route/property/DslPropertyField.tsx b/karavan-space/src/designer/route/property/DslPropertyField.tsx
index c2a066fc..ba20f174 100644
--- a/karavan-space/src/designer/route/property/DslPropertyField.tsx
+++ b/karavan-space/src/designer/route/property/DslPropertyField.tsx
@@ -172,7 +172,7 @@ export class DslPropertyField extends React.Component<Props, State> {
isUriReadOnly = (property: PropertyMeta): boolean => {
const dslName: string = this.props.element?.dslName || '';
- return property.name === 'uri' && !['ToDynamicDefinition', 'WireTapDefinition'].includes(dslName)
+ return property.name === 'uri' && !['ToDefinition', 'ToDynamicDefinition', 'WireTapDefinition'].includes(dslName)
}
selectKubernetes = (value: string) => {
diff --git a/karavan-space/src/designer/utils/CamelUi.tsx b/karavan-space/src/designer/utils/CamelUi.tsx
index a8985521..41e4edb7 100644
--- a/karavan-space/src/designer/utils/CamelUi.tsx
+++ b/karavan-space/src/designer/utils/CamelUi.tsx
@@ -72,6 +72,7 @@ const StepElements: string[] = [
"ThreadsDefinition",
"ThrottleDefinition",
"ThrowExceptionDefinition",
+ "ToDefinition",
"ToDynamicDefinition",
"TransformDefinition",
"TransactedDefinition",