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
The following commit(s) were added to refs/heads/main by this push:
new 549fb43 Saas feature36 (#432)
549fb43 is described below
commit 549fb433d236255e71cc328530bb67800bf9652a
Author: Marat Gubaidullin <[email protected]>
AuthorDate: Thu Jul 28 20:51:36 2022 -0400
Saas feature36 (#432)
* vscode application and export
* Cleanup
---
karavan-core/src/core/api/CamelDefinitionYaml.ts | 2 -
karavan-core/src/core/api/CamelUtil.ts | 4 +-
karavan-core/src/core/api/ProjectModelApi.ts | 72 ---------
.../src/core/model/IntegrationDefinition.ts | 2 -
karavan-core/src/core/model/ProjectModel.ts | 85 ----------
karavan-core/test/application.properties | 20 ---
karavan-core/test/application.spec.ts | 49 ------
karavan-core/test/trait.yaml | 30 ----
karavan-core/test/traits.spec.ts | 49 ------
.../route/property/ComponentParameterField.tsx | 2 +-
.../designer/route/property/DslPropertyField.tsx | 2 +-
karavan-designer/src/designer/traits/TraitCard.tsx | 75 ---------
.../src/designer/traits/TraitProperties.tsx | 139 ----------------
.../src/designer/traits/TraitsDesigner.tsx | 174 ---------------------
karavan-designer/src/designer/utils/CamelUi.tsx | 9 +-
.../src/designer/utils/KaravanIcons.tsx | 13 --
karavan-designer/src/kamelets/KameletCard.tsx | 2 +-
karavan-vscode/icons/dark/add.svg | 85 ----------
karavan-vscode/icons/dark/builder.svg | 61 --------
karavan-vscode/icons/dark/refresh.svg | 1 -
karavan-vscode/icons/dark/run.svg | 52 ------
karavan-vscode/icons/light/add.svg | 52 ------
karavan-vscode/icons/light/builder.svg | 1 -
karavan-vscode/icons/light/refresh.svg | 1 -
karavan-vscode/icons/light/run.svg | 52 ------
karavan-vscode/package.json | 142 ++++++++++++-----
karavan-vscode/src/designerView.ts | 21 +--
karavan-vscode/src/extension.ts | 55 ++++---
karavan-vscode/src/jbang.ts | 23 ++-
karavan-vscode/src/utils.ts | 33 +++-
karavan-vscode/webview/kamelets/KameletCard.tsx | 2 +-
31 files changed, 174 insertions(+), 1136 deletions(-)
diff --git a/karavan-core/src/core/api/CamelDefinitionYaml.ts
b/karavan-core/src/core/api/CamelDefinitionYaml.ts
index d2024a9..aabc3ec 100644
--- a/karavan-core/src/core/api/CamelDefinitionYaml.ts
+++ b/karavan-core/src/core/api/CamelDefinitionYaml.ts
@@ -187,13 +187,11 @@ export class CamelDefinitionYaml {
const int: Integration = new Integration({...camelized});
integration.spec.flows?.push(...this.flowsToCamelElements(int.spec.flows ||
[]));
integration.spec.dependencies =
this.dependenciesToDependency(int.spec.dependencies);
- if (int.spec.traits) integration.spec.traits =
TraitApi.traitsFromYaml(int.spec.traits);
} else if (Array.isArray(camelized)) {
integration.crd = false;
const flows: any[] = camelized;
integration.spec.flows?.push(...this.flowsToCamelElements(flows));
integration.spec.dependencies = this.modelineToDependency(text);
- // integration.spec.traits = this.traitsToCamelElements(flows); //
TODO: Plain yaml Trait ???
}
return integration;
}
diff --git a/karavan-core/src/core/api/CamelUtil.ts
b/karavan-core/src/core/api/CamelUtil.ts
index 84ffdcd..39d4948 100644
--- a/karavan-core/src/core/api/CamelUtil.ts
+++ b/karavan-core/src/core/api/CamelUtil.ts
@@ -16,11 +16,10 @@
*/
import {
Integration,
- CamelElement, Beans, Dependency, CamelElementMeta,
+ CamelElement, Beans, Dependency,
} from "../model/IntegrationDefinition";
import {CamelDefinitionApi} from "./CamelDefinitionApi";
import {KameletDefinition, NamedBeanDefinition, ToDefinition} from
"../model/CamelDefinition";
-import {TraitApi} from "../model/TraitDefinition";
import {KameletApi} from "./KameletApi";
import {KameletModel, Property} from "../model/KameletModels";
import {ComponentProperty} from "../model/ComponentModels";
@@ -44,7 +43,6 @@ export class CamelUtil {
flows.push(newBeans);
});
int.spec.flows = flows;
- if (int.spec.traits) int.spec.traits =
TraitApi.cloneTrait(int.spec.traits);
return int;
}
diff --git a/karavan-core/src/core/api/ProjectModelApi.ts
b/karavan-core/src/core/api/ProjectModelApi.ts
deleted file mode 100644
index 4bf91cd..0000000
--- a/karavan-core/src/core/api/ProjectModelApi.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 {ProjectModel, ProjectProperty} from "../model/ProjectModel";
-import {v4 as uuidv4} from "uuid";
-
-export class ProjectModelApi {
-
- static propertiesToProject = (properties: string): ProjectModel => {
- const lines = properties.split(/\r?\n/).filter(text =>
text.trim().length > 0 && !text.trim().startsWith("#"));
- const project = new ProjectModel();
-
- project.properties = lines.map(value => this.stringToProperty(value));
- return project;
- }
-
- static stringToProperty = (line: string): ProjectProperty => {
- const pair = line.split("=");
- const value = pair[1];
- return ProjectProperty.createNew(pair[0], value);
- }
-
- static propertiesToString = (properties: ProjectProperty[]): string => {
- const result: string[] = [];
- properties.forEach((p, key) => {
- if (p !== undefined) result.push(p.key + "=" + p.value);
- })
- return result.join("\n");
- }
-
- static getProfiles = (properties: ProjectProperty[]): string[] => {
- const result: string[] = [];
- properties.forEach((p, key) => {
- if (p.key.startsWith("%")) {
- const profile = p.key.substring(1, p.key.indexOf("."));
- if (!result.includes(profile)) result.push(profile);
- }
- })
- return result;
- }
-
- static updateProperties = (properties: string, project: ProjectModel):
string => {
- const mapFromProject = this.projectToMap(project);
- const result: string[] = [];
- mapFromProject.forEach((value, key) => {
- if (value !== undefined) result.push(key + "=" + value);
- })
- return result.join("\n");
- }
-
- static projectToMap = (project: ProjectModel): Map<string, any> => {
- const map = new Map<string, any>();
-
- if (project.properties && project.properties.length > 0) {
- project.properties.forEach(p => map.set(p.key, p.value));
- }
- return map;
- }
-}
diff --git a/karavan-core/src/core/model/IntegrationDefinition.ts
b/karavan-core/src/core/model/IntegrationDefinition.ts
index 1885fa4..14e33fc 100644
--- a/karavan-core/src/core/model/IntegrationDefinition.ts
+++ b/karavan-core/src/core/model/IntegrationDefinition.ts
@@ -16,7 +16,6 @@
*/
import {v4 as uuidv4} from 'uuid';
import {NamedBeanDefinition} from "./CamelDefinition";
-import {Trait} from "./TraitDefinition";
export class Dependency {
group: string = '';
@@ -44,7 +43,6 @@ export class Dependency {
export class Spec {
flows?: any[] = [];
dependencies?: Dependency[] = [];
- traits?: Trait;
public constructor(init?: Partial<Spec>) {
Object.assign(this, init);
diff --git a/karavan-core/src/core/model/ProjectModel.ts
b/karavan-core/src/core/model/ProjectModel.ts
deleted file mode 100644
index 9e9af03..0000000
--- a/karavan-core/src/core/model/ProjectModel.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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 {v4 as uuidv4} from "uuid";
-
-export class StepStatus {
- status: 'pending' | 'progress' | 'done' | 'error' = 'pending';
- startTime: number = Date.now();
- endTime?: number;
-
- public constructor(init?: Partial<StepStatus>) {
- Object.assign(this, init);
- }
-
- static progress(): StepStatus {
- return new StepStatus({status: "progress", startTime: Date.now()})
- }
-
- static done(stepStatus?: StepStatus): StepStatus | undefined {
- if (stepStatus){
- stepStatus.status = "done";
- stepStatus.endTime = Date.now();
- }
- return stepStatus
- }
-
- static error(stepStatus?: StepStatus): StepStatus | undefined {
- if (stepStatus) {
- stepStatus.status = "error";
- stepStatus.endTime = Date.now();
- }
- return stepStatus
- }
-}
-
-export class ProjectStatus extends StepStatus{
- export?: StepStatus;
- package?: StepStatus;
- active: boolean = false;
-
- public constructor(init?: Partial<ProjectStatus>) {
- super();
- Object.assign(this, init);
- }
-}
-
-export class ProjectProperty {
- id: string = ''
- key: string = ''
- value: any
-
- public constructor(init?: Partial<ProjectProperty>) {
- Object.assign(this, init);
- }
-
- static createNew(key: string, value: any): ProjectProperty {
- return new ProjectProperty({id: uuidv4(), key: key, value: value})
- }
-}
-
-export class ProjectModel {
- status: ProjectStatus = new ProjectStatus()
- properties: ProjectProperty[] = []
-
- public constructor(init?: Partial<ProjectModel>) {
- Object.assign(this, init);
- }
-
- static createNew(init?: Partial<ProjectModel>): ProjectModel {
- return new ProjectModel(init ? init : {})
- }
-}
\ No newline at end of file
diff --git a/karavan-core/test/application.properties
b/karavan-core/test/application.properties
deleted file mode 100644
index 6123b3b..0000000
--- a/karavan-core/test/application.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# main props
-loggingLevel=info
-camel.main.name=CamelJBang
-camel.main.shutdownTimeout=5
-camel.main.routesReloadEnabled=false
-camel.main.sourceLocationEnabled=true
-camel.main.tracing=false
-camel.main.modeline=true
-camel.main.routesCompileDirectory=.camel-jbang
-camel.jbang.health=false
-camel.jbang.console=false
-camel.main.routesIncludePattern=file:CustomProcessor.java,file:postman.yaml
-camel.jbang.classpathFiles=parcels.png,postgres_db.sql,start.sh
-dependency=mvn:org.apache.camel:camel-kamelet:3.17.0-SNAPSHOT
-dependency=mvn:org.apache.camel:camel-java-joor-dsl:3.17.0-SNAPSHOT
-dependency=mvn:org.apache.camel:camel-rest:3.17.0-SNAPSHOT
-dependency=mvn:org.apache.camel:camel-core-languages:3.17.0-SNAPSHOT
-dependency=mvn:org.apache.camel:camel-direct:3.17.0-SNAPSHOT
-
-message=hello world
\ No newline at end of file
diff --git a/karavan-core/test/application.spec.ts
b/karavan-core/test/application.spec.ts
deleted file mode 100644
index e236477..0000000
--- a/karavan-core/test/application.spec.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 * as fs from 'fs';
-import 'mocha';
-import {expect} from "chai";
-import {ProjectModelApi} from "../src/core/api/ProjectModelApi";
-import {ProjectProperty} from "../lib/model/ProjectModel";
-
-describe('Project configuration', () => {
-
- it('Read properties', () => {
- const props =
fs.readFileSync('test/application.properties',{encoding:'utf8', flag:'r'});
- const project = ProjectModelApi.propertiesToProject(props);
-
- expect("hello world").to.equal(project.properties.find(v => v.key ===
'message')?.value);
-
- project.properties = project.properties.map(value => {
- if (value.key === 'camel.jbang.health') return
ProjectProperty.createNew(value.key, "true");
- else return value;
- })
-
- let newProperties = ProjectModelApi.updateProperties(props, project);
- expect("true").to.equal(project.properties.find(v => v.key ===
'camel.jbang.health')?.value);
-
- project.properties = project.properties.map(p => {
- if (p.key === 'message') {
- p.value = 'HELLO WORLD'
- return p;
- } else return p;
- });
- newProperties = ProjectModelApi.updateProperties(newProperties,
project);
- expect("HELLO WORLD").to.equal(project.properties.find(v => v.key ===
'message')?.value);
- });
-
-});
diff --git a/karavan-core/test/trait.yaml b/karavan-core/test/trait.yaml
deleted file mode 100644
index a0795f0..0000000
--- a/karavan-core/test/trait.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-apiVersion: camel.apache.org/v1
-kind: Integration
-metadata:
- name: test
-spec:
- flows: []
- traits:
- camel:
- configuration:
- runtimeVersion: 3.16.0
- properties:
- - camel.component.seda.queueSize = 10
- - camel.component.seda.enabled = false
- jvm:
- configuration:
- debug: true
- options:
- - option1
- - option2
- classpath: /path/to/my-dependency.jar:/path/to/another-dependency.jar
- threeScale:
- configuration:
- enabled: true
- auto: true
- path: /
- 3scale:
- configuration:
- enabled: true
- auto: true
- path: /
diff --git a/karavan-core/test/traits.spec.ts b/karavan-core/test/traits.spec.ts
deleted file mode 100644
index 6cab79f..0000000
--- a/karavan-core/test/traits.spec.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 {expect} from 'chai';
-import * as fs from 'fs';
-import 'mocha';
-import {CamelDefinitionYaml} from "../src/core/api/CamelDefinitionYaml";
-import {Integration} from "../src/core/model/IntegrationDefinition";
-import {CamelTrait, JvmTrait, ThreeScaleTrait, Trait} from
"../src/core/model/TraitDefinition";
-
-describe('Traits', () => {
-
- it('Traits to YAML', () => {
- const camel = new CamelTrait({runtimeVersion:"3.16.0",
properties:['camel.component.seda.queueSize = 10',
'camel.component.seda.enabled = false']})
- const jvm = new JvmTrait({debug: true, options:["option1", "option2"],
classpath:"/path/to/my-dependency.jar:/path/to/another-dependency.jar"})
- const threeScale = new ThreeScaleTrait({enabled: true, auto: true,
path: "/"})
- const i1 = Integration.createNew("test");
- i1.spec.traits = new Trait({camel: camel, jvm: jvm, threeScale:
threeScale});
-
- const yaml1 = CamelDefinitionYaml.integrationToYaml(i1);
- const yaml2 = fs.readFileSync('test/trait.yaml',{encoding:'utf8',
flag:'r'});
- expect(yaml1).to.equal(yaml2);
- // console.log(yaml1)
- });
-
- it('YAML to Trait', () => {
- const yaml1 = fs.readFileSync('test/trait.yaml',{encoding:'utf8',
flag:'r'});
- const i = CamelDefinitionYaml.yamlToIntegration("demo", yaml1);
-
- expect(i.spec.traits?.camel?.properties?.length).to.equal(2);
-
expect(i.spec.traits?.camel?.properties?.[0]).to.equal("camel.component.seda.queueSize
= 10");
- expect(i.spec.traits?.threeScale?.enabled).to.equal(true);
- expect(i.spec.traits?.threeScale?.path).to.equal("/");
- });
-
-});
\ No newline at end of file
diff --git
a/karavan-designer/src/designer/route/property/ComponentParameterField.tsx
b/karavan-designer/src/designer/route/property/ComponentParameterField.tsx
index 7cb5a86..4116b1b 100644
--- a/karavan-designer/src/designer/route/property/ComponentParameterField.tsx
+++ b/karavan-designer/src/designer/route/property/ComponentParameterField.tsx
@@ -218,7 +218,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) === true :
property.defaultValue !== undefined && property.defaultValue === 'true'}
onChange={e => this.parametersChanged(property.name,
!Boolean(value))}/>
)
}
diff --git a/karavan-designer/src/designer/route/property/DslPropertyField.tsx
b/karavan-designer/src/designer/route/property/DslPropertyField.tsx
index 25f6f94..ede27fc 100644
--- a/karavan-designer/src/designer/route/property/DslPropertyField.tsx
+++ b/karavan-designer/src/designer/route/property/DslPropertyField.tsx
@@ -23,7 +23,7 @@ import {
Select,
SelectVariant,
SelectDirection,
- SelectOption, ExpandableSection, TextArea, Chip, TextInputGroup,
TextInputGroupMain, TextInputGroupUtilities, ChipGroup, Button, Text, Tooltip,
Card, InputGroup, Modal
+ SelectOption, ExpandableSection, TextArea, Chip, TextInputGroup,
TextInputGroupMain, TextInputGroupUtilities, ChipGroup, Button, Text, Tooltip,
Card, InputGroup
} from '@patternfly/react-core';
import '../../karavan.css';
import "@patternfly/patternfly/patternfly.css";
diff --git a/karavan-designer/src/designer/traits/TraitCard.tsx
b/karavan-designer/src/designer/traits/TraitCard.tsx
deleted file mode 100644
index 20e3a47..0000000
--- a/karavan-designer/src/designer/traits/TraitCard.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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 from 'react';
-import {
- Button
-} from '@patternfly/react-core';
-import '../karavan.css';
-import {CamelElement, Integration} from
"karavan-core/lib/model/IntegrationDefinition";
-import DeleteIcon from
"@patternfly/react-icons/dist/js/icons/times-circle-icon";
-
-interface Props {
- trait: CamelElement
- selectedTrait?: CamelElement
- integration: Integration
- // selectMethod: (element: CamelElement) => void
- // selectElement: (element: CamelElement) => void
- // deleteElement: (element: CamelElement) => void
-}
-
-export class TraitCard extends React.Component<Props, any> {
-
- selectElement = (evt: React.MouseEvent) => {
- evt.stopPropagation();
- // this.props.selectElement.call(this, this.props.rest);
- }
-
- selectMethod = (evt: React.MouseEvent) => {
- evt.stopPropagation();
- // this.props.selectMethod.call(this, this.props.rest);
- }
-
- delete = (evt: React.MouseEvent) => {
- evt.stopPropagation();
- // this.props.deleteElement.call(this, this.props.rest);
- }
-
- render() {
- const trait = this.props.trait;
- return (
- <div className={this.props.selectedTrait?.uuid === trait.uuid ?
"rest-card rest-card-selected" : "rest-card rest-card-unselected"} onClick={e
=> this.selectElement(e)}>
- <div className="header">
- <div className="title">Trait</div>
- <div className="title">{trait.dslName.replace("Trait",
"")}</div>
- {/*<div
className="description">{trait.description}</div>*/}
- {/*<Tooltip position={"bottom"} content={<div>Add REST
method</div>}>*/}
- {/* <Button variant={"link"} icon={<AddIcon/>}
aria-label="Add" onClick={e => this.selectMethod(e)} className="add-button">Add
method</Button>*/}
- {/*</Tooltip>*/}
- <Button variant="link" className="delete-button"
onClick={e => this.delete(e)}><DeleteIcon/></Button>
- </div>
- <div className="rest-content" key={Math.random().toString()}>
- {/*{trait.get?.map(get => <RestMethodCard key={get.uuid}
method={get} selectedStep={this.props.selectedStep}
integration={this.props.integration} selectElement={this.props.selectElement}
deleteElement={this.props.deleteElement}/>)}*/}
- {/*{trait.post?.map(post => <RestMethodCard
key={post.uuid} method={post} selectedStep={this.props.selectedStep}
integration={this.props.integration} selectElement={this.props.selectElement}
deleteElement={this.props.deleteElement}/>)}*/}
- {/*{trait.put?.map(put => <RestMethodCard key={put.uuid}
method={put} selectedStep={this.props.selectedStep}
integration={this.props.integration} selectElement={this.props.selectElement}
deleteElement={this.props.deleteElement}/>)}*/}
- {/*{trait.patch?.map(patch => <RestMethodCard
key={patch.uuid} method={patch} selectedStep={this.props.selectedStep}
integration={this.props.integration} selectElement={this.props.selectElement}
deleteElement={this.props.deleteElement}/>)}*/}
- {/*{trait.delete?.map(del => <RestMethodCard
key={del.uuid} method={del} selectedStep={this.props.selectedStep}
integration={this.props.integration} selectElement={this.props.selectElement}
deleteElement={this.props.deleteElement}/>)}*/}
- {/*{trait.head?.map(head => <RestMethodCard
key={head.uuid} method={head} selectedStep={this.props.selectedStep}
integration={this.props.integration} selectElement={this.props.selectElement}
deleteElement={this.props.deleteElement}/>)}*/}
- </div>
- </div>
- );
- }
-}
diff --git a/karavan-designer/src/designer/traits/TraitProperties.tsx
b/karavan-designer/src/designer/traits/TraitProperties.tsx
deleted file mode 100644
index 9aac1da..0000000
--- a/karavan-designer/src/designer/traits/TraitProperties.tsx
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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 from 'react';
-import {
- Form,
- FormGroup
-} from '@patternfly/react-core';
-import '../karavan.css';
-import "@patternfly/patternfly/patternfly.css";
-import {CamelElement, Integration} from
"karavan-core/lib/model/IntegrationDefinition";
-import {v4 as uuidv4} from "uuid";
-import {IntegrationHeader} from "../utils/KaravanComponents";
-
-interface Props {
- integration: Integration
- trait?: CamelElement
- dark: boolean
- onChange: (trait: CamelElement) => void
-}
-
-interface State {
- trait?: CamelElement
- // properties: Map<string, [string, string]>
- key: string
-}
-
-export class TraitProperties extends React.Component<Props, State> {
-
- preparePropertiesMap = (properties: any): Map<string, [string, string]> =>
{
- const result = new Map<string, [string, string]>();
- Object.keys(properties).forEach((k, i, a) => result.set(uuidv4(), [k,
properties[k]]));
- return result;
- }
-
- public state: State = {
- trait: this.props.trait,
- key: '',
- // properties: this.props.trait?.properties ?
this.preparePropertiesMap(this.props.trait?.properties) : new Map<string,
[string, string]>()
- };
-
- componentDidUpdate = (prevProps: Readonly<Props>, prevState:
Readonly<State>, snapshot?: any) => {
- if (prevProps.trait?.uuid !== this.props.trait?.uuid) {
- // this.setBean(this.props.trait);
- }
- // if (prevState.key !== this.state.key && this.state.bean) {
- // const bean = CamelUtil.cloneBean(this.state.bean);
- // const properties: any = {};
- // this.state.properties.forEach(p => properties[p[0]] = p[1]);
- // bean.properties = properties;
- // this.setState({bean: bean});
- // this.props.onChange?.call(this, bean);
- // }
- }
-
- setBean = (trait?: CamelElement) => {
- this.setState({
- trait: trait,
- // properties: bean?.properties ?
this.preparePropertiesMap(bean.properties) : new Map<string, [string, string]>()
- });
- }
-
- beanChanged = (fieldId: string, value: string) => {
- // if (this.state.bean) {
- // const bean = CamelUtil.cloneBean(this.state.bean);
- // (bean as any)[fieldId] = value;
- // this.setState({bean: bean});
- // this.props.onChange?.call(this, bean);
- // }
- }
-
- propertyChanged = (uuid: string, key: string, value: string) => {
- // this.setState(state => {
- // state.properties.set(uuid, [key, value]);
- // return {properties: state.properties, key:
Math.random().toString()};
- // })
- }
-
- propertyDeleted = (uuid: string) => {
- this.setState(state => {
- // state.properties.delete(uuid);
- // return {properties: state.properties, key:
Math.random().toString()};
- })
- }
-
- getBeanForm() {
- const trait = this.state.trait;
- return (
- <>
- <FormGroup label="Name" fieldId="name" isRequired>
- {/*<TextInput className="text-field" isRequired
type="text" id="name" name="name" value={trait?.name}*/}
- {/* onChange={e => this.beanChanged("name",
e)}/>*/}
- </FormGroup>
- <FormGroup label="Type" fieldId="type" isRequired>
- {/*<TextInput className="text-field" isRequired
type="text" id="type" name="type" value={bean?.type} onChange={e =>
this.beanChanged("type", e)}/>*/}
- </FormGroup>
- {/*<FormGroup label="Properties" fieldId="properties"
className="bean-properties">*/}
- {/* {Array.from(this.state.properties.entries()).map((v,
index, array) => {*/}
- {/* const i = v[0];*/}
- {/* const key = v[1][0];*/}
- {/* const value = v[1][1];*/}
- {/* return (*/}
- {/* <div key={"key-" + i}
className="bean-property">*/}
- {/* <TextInput className="text-field"
isRequired type="text" id="key" name="key" value={key} onChange={e =>
this.propertyChanged(i, e, value)}/>*/}
- {/* <TextInput className="text-field"
isRequired type="text" id="value" name="value" value={value} onChange={e =>
this.propertyChanged(i, key, e)}/>*/}
- {/* <Button variant="link"
className="delete-button" onClick={e =>
this.propertyDeleted(i)}><DeleteIcon/></Button>*/}
- {/* </div>*/}
- {/* )*/}
- {/* })}*/}
- {/* <Button variant="link" className="add-button"
onClick={e => this.propertyChanged(uuidv4(), '', '')}><AddIcon/>Add
property</Button>*/}
- {/*</FormGroup>*/}
- </>
- )
- }
-
- render() {
- return (
- <div className='properties' key={this.state.trait ?
this.state.trait.uuid : 'integration'}>
- <Form autoComplete="off" onSubmit={event =>
event.preventDefault()}>
- {this.state.trait === undefined && <IntegrationHeader
integration={this.props.integration}/>}
- {this.state.trait !== undefined && this.getBeanForm()}
- </Form>
- </div>
- )
- }
-}
\ No newline at end of file
diff --git a/karavan-designer/src/designer/traits/TraitsDesigner.tsx
b/karavan-designer/src/designer/traits/TraitsDesigner.tsx
deleted file mode 100644
index 191e677..0000000
--- a/karavan-designer/src/designer/traits/TraitsDesigner.tsx
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * 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 from 'react';
-import {
- Button, DrawerPanelContent, EmptyState, EmptyStateBody, EmptyStateIcon,
Modal, PageSection, Title
-} from '@patternfly/react-core';
-import '../karavan.css';
-import {NamedBeanDefinition} from "karavan-core/lib/model/CamelDefinition";
-import {Integration} from "karavan-core/lib/model/IntegrationDefinition";
-import {CamelUi} from "../utils/CamelUi";
-import {TraitProperties} from "./TraitProperties";
-import CubesIcon from "@patternfly/react-icons/dist/esm/icons/cubes-icon";
-import {CamelElement} from "karavan-core/src/core/model/IntegrationDefinition";
-
-interface Props {
- onSave?: (integration: Integration, propertyOnly: boolean) => void
- integration: Integration
- dark: boolean
-}
-
-interface State {
- integration: Integration
- showDeleteConfirmation: boolean
- selectedTrait?: CamelElement
- key: string
- showBeanEditor: boolean
- propertyOnly: boolean
-}
-
-export class TraitsDesigner extends React.Component<Props, State> {
-
- public state: State = {
- integration: this.props.integration,
- showDeleteConfirmation: false,
- key: "",
- showBeanEditor: false,
- propertyOnly: false
- };
-
- componentDidUpdate = (prevProps: Readonly<Props>, prevState:
Readonly<State>, snapshot?: any) => {
- if (prevState.key !== this.state.key) {
- this.props.onSave?.call(this, this.state.integration,
this.state.propertyOnly);
- }
- }
-
- showDeleteConfirmation = (trait: CamelElement) => {
- this.setState({selectedTrait: trait, showDeleteConfirmation: true});
- }
-
- onIntegrationUpdate = (i: Integration) => {
- this.setState({integration: i, showDeleteConfirmation: false, key:
Math.random().toString()});
- }
-
- deleteBean = () => {
- // const i =
CamelDefinitionApiExt.deleteTraitFromIntegration(this.state.integration,
this.state.selectedTrait);
- // this.setState({
- // integration: i,
- // showDeleteConfirmation: false,
- // key: Math.random().toString(),
- // selectedBean: new NamedBeanDefinition()
- // });
- }
-
- changeTrait = (trait: CamelElement) => {
- // const clone = CamelUtil.cloneIntegration(this.state.integration);
- // const i = CamelDefinitionApiExt.addBeanToIntegration(clone, bean);
- // this.setState({integration: i, key: Math.random().toString(),
selectedBean: bean});
- }
-
- getDeleteConfirmation() {
- return (<Modal
- className="modal-delete"
- title="Confirmation"
- isOpen={this.state.showDeleteConfirmation}
- onClose={() => this.setState({showDeleteConfirmation: false})}
- actions={[
- <Button key="confirm" variant="primary" onClick={e =>
this.deleteBean()}>Delete</Button>,
- <Button key="cancel" variant="link"
- onClick={e => this.setState({showDeleteConfirmation:
false})}>Cancel</Button>
- ]}
- onEscapePress={e => this.setState({showDeleteConfirmation:
false})}>
- <div>
- Delete bean from integration?
- </div>
- </Modal>)
- }
-
- selectBean = (bean?: NamedBeanDefinition) => {
- // this.setState({selectedBean: bean})
- }
-
- unselectBean = (evt: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
- if ((evt.target as any).dataset.click === 'BEANS') {
- evt.stopPropagation()
- // this.setState({selectedBean: undefined})
- }
- };
-
- createBean = () => {
- this.changeTrait(new NamedBeanDefinition());
- }
-
- getPropertiesPanel() {
- return (
- <DrawerPanelContent isResizable hasNoBorder defaultSize={'400px'}
maxSize={'800px'} minSize={'300px'}>
- <TraitProperties integration={this.props.integration}
- trait={this.state.selectedTrait}
- dark={this.props.dark}
- onChange={this.changeTrait}/>
- </DrawerPanelContent>
- )
- }
-
- render() {
- const traits = CamelUi.getBeans(this.state.integration);
- return (
- <PageSection className="exception-page" isFilled
padding={{default: 'noPadding'}}>
- <div className="exception-page-columns">
- {/*<PageSection className="rest-page" isFilled padding={{default:
'noPadding'}}>*/}
- {/* <div className="rest-page-columns">*/}
- <EmptyState>
- <EmptyStateIcon icon={CubesIcon} />
- <Title headingLevel="h4" size="lg">
- Traits
- </Title>
- <EmptyStateBody>
- Traits not implemented yet
- </EmptyStateBody>
- </EmptyState>
- {/*<Drawer isExpanded isInline>*/}
- {/* <DrawerContent
panelContent={this.getPropertiesPanel()}>*/}
- {/* <DrawerContentBody>*/}
- {/* <div className="graph" data-click="REST"
onClick={event => this.unselectBean(event)}>*/}
- {/* <div className="flows">*/}
- {/* {traits?.map(trait => <TraitCard
key={trait.uuid + this.state.key}*/}
- {/*
selectedTrait={this.state.selectedTrait}*/}
- {/*
integration={this.props.integration}*/}
- {/*
trait={trait}*/}
- {/* //
selectElement={this.selectBean}*/}
- {/* //
deleteElement={this.showDeleteConfirmation}*/}
- {/* />)}*/}
- {/* <div className="add-rest">*/}
- {/* <Button*/}
- {/* variant={traits?.length ===
0 ? "primary" : "secondary"}*/}
- {/* data-click="ADD_TRAIT"*/}
- {/* icon={<PlusIcon/>}*/}
- {/* onClick={e =>
this.createBean()}>Create new trait*/}
- {/* </Button>*/}
- {/* </div>*/}
- {/* </div>*/}
- {/* </div>*/}
- {/* </DrawerContentBody>*/}
- {/* </DrawerContent>*/}
- {/*</Drawer>*/}
- </div>
- {this.getDeleteConfirmation()}
- </PageSection>
- );
- }
-}
diff --git a/karavan-designer/src/designer/utils/CamelUi.tsx
b/karavan-designer/src/designer/utils/CamelUi.tsx
index 661fb7a..5e8af0a 100644
--- a/karavan-designer/src/designer/utils/CamelUi.tsx
+++ b/karavan-designer/src/designer/utils/CamelUi.tsx
@@ -23,7 +23,6 @@ import {CamelUtil} from "karavan-core/lib/api/CamelUtil";
import {CamelDefinitionApiExt} from
"karavan-core/lib/api/CamelDefinitionApiExt";
import {NamedBeanDefinition, RouteDefinition, SagaDefinition, ToDefinition}
from "karavan-core/lib/model/CamelDefinition";
import {CamelElement, Dependency, Integration} from
"karavan-core/lib/model/IntegrationDefinition";
-import {Trait} from "karavan-core/src/core/model/TraitDefinition";
import {AggregateIcon, ChoiceIcon, FilterIcon, SagaIcon, SortIcon, SplitIcon,
TransformIcon} from "./KaravanIcons";
import React from "react";
@@ -425,7 +424,7 @@ export class CamelUi {
}
static getIconForDsl = (dsl: DslMetaModel):JSX.Element => {
- if (dsl.dsl && dsl.dsl === "KameletDefinition" || dsl.navigation ===
'kamelet') {
+ if (dsl.dsl && (dsl.dsl === "KameletDefinition" || dsl.navigation ===
'kamelet')) {
return
this.getIconFromSource(CamelUi.getKameletIconByName(dsl.name));
} else if ((dsl.dsl && dsl.dsl === "FromDefinition")
&& dsl.uri?.startsWith("kamelet")) {
@@ -479,7 +478,6 @@ export class CamelUi {
const result = new Map<string, number>();
result.set('routes', i.spec.flows?.filter((e: any) => e.dslName ===
'RouteDefinition').length || 0);
result.set('rest', i.spec.flows?.filter((e: any) => e.dslName ===
'RestDefinition').length || 0);
- result.set('traits', this.getTraitCounts(i.spec.traits));
const beans = i.spec.flows?.filter((e: any) => e.dslName === 'Beans');
if (beans && beans.length > 0 && beans[0].beans &&
beans[0].beans.length > 0){
result.set('beans', Array.from(beans[0].beans).length);
@@ -490,11 +488,6 @@ export class CamelUi {
return result;
}
- static getTraitCounts = (t?: Trait): number => {
- if (t) return Object.getOwnPropertyNames(t).filter(name => name !==
'dslName' && name !== "uuid" && (t as any)[name]).length;
- return 0;
- }
-
static getRoutes = (integration: Integration): CamelElement[] => {
const result: CamelElement[] = [];
integration.spec.flows?.filter((e: any) => e.dslName ===
'RouteDefinition')
diff --git a/karavan-designer/src/designer/utils/KaravanIcons.tsx
b/karavan-designer/src/designer/utils/KaravanIcons.tsx
index 5f5441a..26860d5 100644
--- a/karavan-designer/src/designer/utils/KaravanIcons.tsx
+++ b/karavan-designer/src/designer/utils/KaravanIcons.tsx
@@ -101,19 +101,6 @@ export function getDesignerIcon(icon: string) {
<rect x="5.91" y="15" width="20.17" height="2"
transform="translate(-3.6 27.31) rotate(-75)"/>
<rect id="_Transparent_Rectangle_" data-name="<Transparent
Rectangle>" className="cls-1" width="32" height="32" transform="translate(0
32) rotate(-90)"/>
</svg>)
- if (icon === 'traits') return (
- <svg className="top-icon" width="32px" height="32px" viewBox="0 0 32
32" id="icon">
- <defs>
- <style>{".cls-1{fill:none;}"}</style>
- </defs>
- <title>settings</title>
- <path
-
d="M27,16.76c0-.25,0-.5,0-.76s0-.51,0-.77l1.92-1.68A2,2,0,0,0,29.3,11L26.94,7a2,2,0,0,0-1.73-1,2,2,0,0,0-.64.1l-2.43.82a11.35,11.35,0,0,0-1.31-.75l-.51-2.52a2,2,0,0,0-2-1.61H13.64a2,2,0,0,0-2,1.61l-.51,2.52a11.48,11.48,0,0,0-1.32.75L7.43,6.06A2,2,0,0,0,6.79,6,2,2,0,0,0,5.06,7L2.7,11a2,2,0,0,0,.41,2.51L5,15.24c0,.25,0,.5,0,.76s0,.51,0,.77L3.11,18.45A2,2,0,0,0,2.7,21L5.06,25a2,2,0,0,0,1.73,1,2,2,0,0,0,.64-.1l2.43-.82a11.35,11.35,0,0,0,1.31.75l.51,2.52a2,2,0,0,0,2,1.61h4.72a
[...]
- transform="translate(0 0)"/>
- <path
d="M16,22a6,6,0,1,1,6-6A5.94,5.94,0,0,1,16,22Zm0-10a3.91,3.91,0,0,0-4,4,3.91,3.91,0,0,0,4,4,3.91,3.91,0,0,0,4-4A3.91,3.91,0,0,0,16,12Z"
- transform="translate(0 0)"/>
- <rect id="_Transparent_Rectangle_" data-name="<Transparent
Rectangle>" className="cls-1" width="32" height="32"/>
- </svg>)
if (icon === 'yaml') return (
<svg className="top-icon" x="0px" y="0px" width="32px" height="32px"
viewBox="0 0 32 32">
diff --git a/karavan-designer/src/kamelets/KameletCard.tsx
b/karavan-designer/src/kamelets/KameletCard.tsx
index 31ac3c6..2bae9fc 100644
--- a/karavan-designer/src/kamelets/KameletCard.tsx
+++ b/karavan-designer/src/kamelets/KameletCard.tsx
@@ -16,7 +16,7 @@
*/
import React from 'react';
import {
- CardHeader, Card, CardTitle, CardBody, CardActions, CardFooter,Badge
+ CardHeader, Card, CardTitle, CardBody, CardFooter,Badge
} from '@patternfly/react-core';
import '../designer/karavan.css';
import {KameletModel} from "karavan-core/lib/model/KameletModels";
diff --git a/karavan-vscode/icons/dark/add.svg
b/karavan-vscode/icons/dark/add.svg
deleted file mode 100644
index 1d25adb..0000000
--- a/karavan-vscode/icons/dark/add.svg
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version:
6.00 Build 0) -->
-
-<svg
- version="1.1"
- id="Capa_1"
- x="0px"
- y="0px"
- viewBox="0 0 42 42"
- style="enable-background:new 0 0 42 42;"
- xml:space="preserve"
- sodipodi:docname="add.svg"
- inkscape:version="1.1.2 (b8e25be8, 2022-02-05)"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:svg="http://www.w3.org/2000/svg"><defs
- id="defs859" /><sodipodi:namedview
- id="namedview857"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- inkscape:pagecheckerboard="0"
- showgrid="false"
- inkscape:zoom="17.119048"
- inkscape:cx="1.8692629"
- inkscape:cy="21.700974"
- inkscape:window-width="1312"
- inkscape:window-height="969"
- inkscape:window-x="72"
- inkscape:window-y="25"
- inkscape:window-maximized="0"
- inkscape:current-layer="Capa_1" />
-<polygon
- points="42,19 23,19 23,0 19,0 19,19 0,19 0,23 19,23 19,42 23,42 23,23 42,23
"
- id="polygon824"
- style="fill:#c5c5c5;fill-opacity:1" />
-<g
- id="g826">
-</g>
-<g
- id="g828">
-</g>
-<g
- id="g830">
-</g>
-<g
- id="g832">
-</g>
-<g
- id="g834">
-</g>
-<g
- id="g836">
-</g>
-<g
- id="g838">
-</g>
-<g
- id="g840">
-</g>
-<g
- id="g842">
-</g>
-<g
- id="g844">
-</g>
-<g
- id="g846">
-</g>
-<g
- id="g848">
-</g>
-<g
- id="g850">
-</g>
-<g
- id="g852">
-</g>
-<g
- id="g854">
-</g>
-</svg>
diff --git a/karavan-vscode/icons/dark/builder.svg
b/karavan-vscode/icons/dark/builder.svg
deleted file mode 100644
index a1e57ce..0000000
--- a/karavan-vscode/icons/dark/builder.svg
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- width="32px"
- height="32px"
- viewBox="0 0 32 32"
- id="icon"
- version="1.1"
- sodipodi:docname="builder.svg"
- inkscape:version="1.1.2 (b8e25be8, 2022-02-05)"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:dc="http://purl.org/dc/elements/1.1/">
- <sodipodi:namedview
- id="namedview834"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- inkscape:pagecheckerboard="0"
- showgrid="false"
- inkscape:zoom="22.46875"
- inkscape:cx="13.79694"
- inkscape:cy="16.534075"
- inkscape:window-width="1312"
- inkscape:window-height="969"
- inkscape:window-x="72"
- inkscape:window-y="25"
- inkscape:window-maximized="0"
- inkscape:current-layer="icon" />
- <defs
- id="defs826">
- <style
- id="style824">.cls-1{fill:none;}</style>
- </defs>
- <title
- id="title828">tools</title>
- <path
-
d="M12.1,2A9.8,9.8,0,0,0,6.7,3.6L13.1,10a2.1,2.1,0,0,1,.2,3,2.1,2.1,0,0,1-3-.2L3.7,6.4A9.84,9.84,0,0,0,2,12.1,10.14,10.14,0,0,0,12.1,22.2a10.9,10.9,0,0,0,2.6-.3l6.7,6.7a5,5,0,0,0,7.1-7.1l-6.7-6.7a10.9,10.9,0,0,0,.3-2.6A10,10,0,0,0,12.1,2Zm8,10.1a7.61,7.61,0,0,1-.3,2.1l-.3,1.1.8.8L27,22.8a2.88,2.88,0,0,1,.9,2.1A2.72,2.72,0,0,1,27,27a2.9,2.9,0,0,1-4.2,0l-6.7-6.7-.8-.8-1.1.3a7.61,7.61,0,0,1-2.1.3,8.27,8.27,0,0,1-5.7-2.3A7.63,7.63,0,0,1,4,12.1a8.33,8.33,0,0,1,.3-2.2l4.4,4.4a4.14,4.14,0,
[...]
- id="path830"
- style="stroke:#c5c5c5;stroke-opacity:1;fill:#c5c5c5;fill-opacity:1" />
- <rect
- id="_Transparent_Rectangle_"
- data-name="<Transparent Rectangle>"
- class="cls-1"
- width="32"
- height="32" />
- <metadata
- id="metadata916">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:title>tools</dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
-</svg>
diff --git a/karavan-vscode/icons/dark/refresh.svg
b/karavan-vscode/icons/dark/refresh.svg
deleted file mode 100644
index d79fdaa..0000000
--- a/karavan-vscode/icons/dark/refresh.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path
d="M13.451 5.609l-.579-.939-1.068.812-.076.094c-.335.415-.927 1.341-1.124
2.876l-.021.165.033.163.071.345c0 1.654-1.346 3-3 3-.795
0-1.545-.311-2.107-.868-.563-.567-.873-1.317-.873-2.111 0-1.431 1.007-2.632
2.351-2.929v2.926s2.528-2.087
2.984-2.461h.012l3.061-2.582-4.919-4.1h-1.137v2.404c-3.429.318-6.121
3.211-6.121 6.721 0 1.809.707 3.508 1.986 4.782 1.277 1.282 2.976 1.988 4.784
1.988 3.722 0 6.75-3.028 6.75-6.75 0-1. [...]
\ No newline at end of file
diff --git a/karavan-vscode/icons/dark/run.svg
b/karavan-vscode/icons/dark/run.svg
deleted file mode 100644
index 796aaa5..0000000
--- a/karavan-vscode/icons/dark/run.svg
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- width="32px"
- height="32px"
- viewBox="0 0 32 32"
- id="icon"
- version="1.1"
- sodipodi:docname="run.svg"
- inkscape:version="1.1.2 (b8e25be8, 2022-02-05)"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:svg="http://www.w3.org/2000/svg">
- <sodipodi:namedview
- id="namedview959"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- inkscape:pagecheckerboard="0"
- showgrid="false"
- inkscape:zoom="22.46875"
- inkscape:cx="1.4242003"
- inkscape:cy="16.534075"
- inkscape:window-width="1296"
- inkscape:window-height="969"
- inkscape:window-x="72"
- inkscape:window-y="25"
- inkscape:window-maximized="0"
- inkscape:current-layer="icon" />
- <defs
- id="defs953">
- <style
- id="style951">
- .cls-1 {
- fill: none;
- }
- </style>
- </defs>
- <path
-
d="M7,28a1,1,0,0,1-1-1V5a1,1,0,0,1,1.4819-.8763l20,11a1,1,0,0,1,0,1.7525l-20,11A1.0005,1.0005,0,0,1,7,28ZM8,6.6909V25.3088L24.9248,16Z"
- transform="translate(0)"
- id="path955"
- style="fill:#c5c5c5;fill-opacity:1" />
- <rect
- id="_Transparent_Rectangle_"
- data-name="<Transparent Rectangle>"
- class="cls-1"
- width="32"
- height="32" />
-</svg>
diff --git a/karavan-vscode/icons/light/add.svg
b/karavan-vscode/icons/light/add.svg
deleted file mode 100644
index 4cf9ebd..0000000
--- a/karavan-vscode/icons/light/add.svg
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Uploaded to SVGRepo https://www.svgrepo.com -->
-
-<svg
- version="1.1"
- id="icon"
- x="0px"
- y="0px"
- width="32px"
- height="32px"
- viewBox="0 0 32 32"
- style="enable-background:new 0 0 32 32;"
- xml:space="preserve"
- sodipodi:docname="add.svg"
- inkscape:version="1.1.2 (b8e25be8, 2022-02-05)"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:svg="http://www.w3.org/2000/svg"><defs
- id="defs833" /><sodipodi:namedview
- id="namedview831"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- inkscape:pagecheckerboard="0"
- showgrid="false"
- inkscape:zoom="22.46875"
- inkscape:cx="1.4242003"
- inkscape:cy="16.534075"
- inkscape:window-width="1312"
- inkscape:window-height="969"
- inkscape:window-x="72"
- inkscape:window-y="25"
- inkscape:window-maximized="0"
- inkscape:current-layer="icon" />
-<style
- type="text/css"
- id="style824">
- .st0{fill:none;}
-</style>
-<polygon
- points="17,15 17,8 15,8 15,15 8,15 8,17 15,17 15,24 17,24 17,17 24,17 24,15
"
- id="polygon826"
- style="fill:#424242;fill-opacity:1" />
-<rect
- class="st0"
- width="32"
- height="32"
- id="rect828" />
-</svg>
diff --git a/karavan-vscode/icons/light/builder.svg
b/karavan-vscode/icons/light/builder.svg
deleted file mode 100644
index 16574e1..0000000
--- a/karavan-vscode/icons/light/builder.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg width="32px" height="32px" viewBox="0 0 32 32" id="icon"
xmlns="http://www.w3.org/2000/svg"><defs><style>.cls-1{fill:none;}</style></defs><title>tools</title><path
d="M12.1,2A9.8,9.8,0,0,0,6.7,3.6L13.1,10a2.1,2.1,0,0,1,.2,3,2.1,2.1,0,0,1-3-.2L3.7,6.4A9.84,9.84,0,0,0,2,12.1,10.14,10.14,0,0,0,12.1,22.2a10.9,10.9,0,0,0,2.6-.3l6.7,6.7a5,5,0,0,0,7.1-7.1l-6.7-6.7a10.9,10.9,0,0,0,.3-2.6A10,10,0,0,0,12.1,2Zm8,10.1a7.61,7.61,0,0,1-.3,2.1l-.3,1.1.8.8L27,22.8a2.88,2.88,0,0,1,.9,2.1A2.72,2.72,0
[...]
\ No newline at end of file
diff --git a/karavan-vscode/icons/light/refresh.svg
b/karavan-vscode/icons/light/refresh.svg
deleted file mode 100644
index e034574..0000000
--- a/karavan-vscode/icons/light/refresh.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path
d="M13.451 5.609l-.579-.939-1.068.812-.076.094c-.335.415-.927 1.341-1.124
2.876l-.021.165.033.163.071.345c0 1.654-1.346 3-3 3-.795
0-1.545-.311-2.107-.868-.563-.567-.873-1.317-.873-2.111 0-1.431 1.007-2.632
2.351-2.929v2.926s2.528-2.087
2.984-2.461h.012l3.061-2.582-4.919-4.1h-1.137v2.404c-3.429.318-6.121
3.211-6.121 6.721 0 1.809.707 3.508 1.986 4.782 1.277 1.282 2.976 1.988 4.784
1.988 3.722 0 6.75-3.028 6.75-6.75 0-1. [...]
\ No newline at end of file
diff --git a/karavan-vscode/icons/light/run.svg
b/karavan-vscode/icons/light/run.svg
deleted file mode 100644
index f00270f..0000000
--- a/karavan-vscode/icons/light/run.svg
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- width="32px"
- height="32px"
- viewBox="0 0 32 32"
- id="icon"
- version="1.1"
- sodipodi:docname="run.svg"
- inkscape:version="1.1.2 (b8e25be8, 2022-02-05)"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:svg="http://www.w3.org/2000/svg">
- <sodipodi:namedview
- id="namedview1068"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- inkscape:pagecheckerboard="0"
- showgrid="false"
- inkscape:zoom="22.46875"
- inkscape:cx="1.4242003"
- inkscape:cy="16.534075"
- inkscape:window-width="1296"
- inkscape:window-height="969"
- inkscape:window-x="123"
- inkscape:window-y="378"
- inkscape:window-maximized="0"
- inkscape:current-layer="icon" />
- <defs
- id="defs1062">
- <style
- id="style1060">
- .cls-1 {
- fill: none;
- }
- </style>
- </defs>
- <path
-
d="M7,28a1,1,0,0,1-1-1V5a1,1,0,0,1,1.4819-.8763l20,11a1,1,0,0,1,0,1.7525l-20,11A1.0005,1.0005,0,0,1,7,28ZM8,6.6909V25.3088L24.9248,16Z"
- transform="translate(0)"
- id="path1064"
- style="fill:#424242;fill-opacity:1" />
- <rect
- id="_Transparent_Rectangle_"
- data-name="<Transparent Rectangle>"
- class="cls-1"
- width="32"
- height="32" />
-</svg>
diff --git a/karavan-vscode/package.json b/karavan-vscode/package.json
index 531b602..1cc46e5 100644
--- a/karavan-vscode/package.json
+++ b/karavan-vscode/package.json
@@ -33,10 +33,6 @@
"homepage":
"https://github.com/apache/camel-karavan/tree/main/karavan-vscode",
"keywords": [
"Camel",
- "Camel K",
- "Camel-K",
- "camelk",
- "kamel",
"Tool",
"Integration",
"Camel Yaml",
@@ -45,17 +41,18 @@
"activationEvents": [
"onCommand:karavan.create-crd",
"onCommand:karavan.create-yaml",
+ "onCommand:karavan.create-application",
"onCommand:karavan.open",
"onCommand:karavan.open-file",
"onCommand:karavan.jbang-run-file",
"onCommand:karavan.jbang-run-project",
"onCommand:karavan.jbang-export",
"onCommand:karavan.generate-rest",
- "onView:integrations",
"onCommand:karavan.openKamelets",
"onCommand:karavan.openComponents",
"onCommand:karavan.openEip",
- "onCommand:karavan.reportIssue"
+ "onCommand:karavan.reportIssue",
+ "onView:integrations"
],
"main": "./dist/extension.js",
"contributes": {
@@ -64,13 +61,36 @@
"properties": {
"camel.version": {
"type": "string",
- "default": "3.17.0",
- "description": "Camel version"
+ "default": "3.18.0",
+ "description": "Camel version",
+ "scope": "machine",
+ "order": 10
+ },
+ "camel.runtimes": {
+ "type": "string",
+ "default": "quarkus",
+ "enum": [
+ "quarkus",
+ "spring-boot",
+ "camel-main"
+ ],
+ "description": "Runtimes",
+ "scope": "machine",
+ "order": 20
+ },
+ "camel.quarkus-version": {
+ "type": "string",
+ "default": "2.11.0.Final",
+ "description": "Camel-quarkus version",
+ "scope": "machine",
+ "order": 21
},
"camel.maxMessages": {
"type": "integer",
"default": 10,
- "description": "Maximum number of messages to process before
stopping"
+ "description": "Maximum number of messages to process before
stopping",
+ "scope": "machine",
+ "order": 30
},
"camel.loggingLevel": {
"type": "string",
@@ -81,32 +101,77 @@
"debug",
"trace"
],
- "description": "Logging level"
+ "description": "Logging level",
+ "scope": "machine",
+ "order": 40
},
"camel.dev": {
"type": "boolean",
"default": "true",
- "description": "Run in developer mode (including reload routes on
change)"
- },
- "camel.health": {
- "type": "boolean",
- "default": false,
- "description": "Enable health-check when run in Jbang"
+ "description": "Run in developer mode (including reload routes on
change)",
+ "scope": "machine",
+ "order": 50
},
"camel.messageTracing": {
"type": "boolean",
"default": false,
- "description": "Logging message details during routing"
+ "description": "Logging message details during routing",
+ "scope": "machine",
+ "order": 60
},
"Karavan.kameletsPath": {
"type": "string",
"default": "",
- "description": "Custom Kamelets Path"
+ "description": "Custom Kamelets Path",
+ "scope": "machine",
+ "order": 65
},
"Karavan.showStartHelp": {
"type": "boolean",
"default": true,
- "description": "Show Karavan help tour"
+ "description": "Show Karavan help tour",
+ "scope": "machine",
+ "order": 70
+ },
+ "Karavan.applicationProperties": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "string"
+ },
+ "default": [
+ "camel.jbang.project-id=$NAME",
+ "camel.jbang.project-name=$NAME",
+ "camel.jbang.project-description=$NAME",
+ "camel.jbang.gav=$GAV",
+ "camel.jbang.runtime=$RUNTIME",
+
"camel.jbang.dependencies=mvn:io.quarkus:quarkus-container-image-jib,mvn:org.apache.camel.quarkus:camel-quarkus-microprofile-health,mvn:io.quarkus:quarkus-openshift",
+ "camel.health.enabled=true",
+ "camel.health.exposure-level=full"
+ ],
+ "description": "Default application.properties template",
+ "scope": "machine",
+ "order": 99
+ },
+ "Karavan.quarkusApplicationProperties": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "string"
+ },
+ "default": [
+ "camel.jbang.quarkusVersion=$RUNTIME_VERSION",
+ "quarkus.kubernetes-client.trust-certs=true",
+ "quarkus.container-image.builder=jib",
+ "quarkus.container-image.group=karavan",
+ "quarkus.container-image.name=$NAME",
+ "quarkus.openshift.route.expose=false",
+ "quarkus.openshift.part-of=$NAME",
+ "quarkus.openshift.replicas=1"
+ ],
+ "description": "Default application.properties template for Quarkus
Runtime",
+ "scope": "machine",
+ "order": 100
}
}
},
@@ -114,15 +179,17 @@
{
"command": "karavan.create-crd",
"title": "Karavan: Create CRD",
- "icon": {
- "light": "./icons/light/add.svg",
- "dark": "./icons/dark/add.svg"
- }
+ "icon": "$(add)"
},
{
"command": "karavan.create-yaml",
"title": "Karavan: Create Integration"
},
+ {
+ "command": "karavan.create-application",
+ "title": "Karavan: Create Application",
+ "icon": "$(symbol-property)"
+ },
{
"command": "karavan.open",
"title": "Karavan: Open",
@@ -138,26 +205,17 @@
{
"command": "karavan.jbang-run-file",
"title": "Karavan: Run File",
- "icon": {
- "light": "./icons/light/run.svg",
- "dark": "./icons/dark/run.svg"
- }
+ "icon": "$(run)"
},
{
"command": "karavan.jbang-run-project",
"title": "Karavan: Run Project",
- "icon": {
- "light": "./icons/light/run.svg",
- "dark": "./icons/dark/run.svg"
- }
+ "icon": "$(run)"
},
{
"command": "karavan.jbang-export",
"title": "Karavan: Export",
- "icon": {
- "light": "./icons/light/builder.svg",
- "dark": "./icons/dark/builder.svg"
- }
+ "icon": "$(export)"
},
{
"command": "karavan.generate-rest",
@@ -166,18 +224,12 @@
{
"command": "integrations.refresh",
"title": "Refresh",
- "icon": {
- "light": "icons/light/refresh.svg",
- "dark": "icons/dark/refresh.svg"
- }
+ "icon": "$(refresh)"
},
{
"command": "openapi.refresh",
"title": "Refresh",
- "icon": {
- "light": "icons/light/refresh.svg",
- "dark": "icons/dark/refresh.svg"
- }
+ "icon": "$(refresh)"
},
{
"command": "karavan.openKamelets",
@@ -206,6 +258,10 @@
"command": "karavan.create-yaml",
"when": "explorerResourceIsFolder || explorerResourceIsRoot"
},
+ {
+ "command": "karavan.create-application",
+ "when": "explorerResourceIsFolder || explorerResourceIsRoot"
+ },
{
"command": "karavan.open",
"when": "resourceExtname == .yaml"
diff --git a/karavan-vscode/src/designerView.ts
b/karavan-vscode/src/designerView.ts
index aa89553..05f2532 100644
--- a/karavan-vscode/src/designerView.ts
+++ b/karavan-vscode/src/designerView.ts
@@ -49,7 +49,7 @@ export class DesignerView {
jbangRun(fullPath: string) {
const filename = this.getFilename(fullPath);
if (filename && this.rootPath) {
- this.selectProfile(this.rootPath, filename);
+ jbang.camelJbangRun(this.rootPath, filename);
}
}
@@ -73,25 +73,6 @@ export class DesignerView {
});
}
}
-
- selectProfile(rootPath: string, filename?: string) {
- if (this.rootPath) {
- utils.getProfiles().then(profiles => {
- if (profiles && profiles.length > 0) {
- window.showQuickPick(profiles).then((profile) => {
- if (!profile) {
- return
- } else {
- jbang.camelJbangRun(rootPath, profile, filename);
- }
- })
- } else {
- jbang.camelJbangRun(rootPath, "application", filename);
- }
- });
- }
- }
-
createIntegration(crd: boolean, rootPath?: string) {
window
.showInputBox({
diff --git a/karavan-vscode/src/extension.ts b/karavan-vscode/src/extension.ts
index ee95900..4924b8d 100644
--- a/karavan-vscode/src/extension.ts
+++ b/karavan-vscode/src/extension.ts
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { ExtensionContext, Uri, window, workspace, commands } from 'vscode';
+import { ExtensionContext, Uri, window, workspace, commands, QuickPickItem }
from 'vscode';
import { DesignerView } from "./designerView";
import { IntegrationView } from "./integrationView";
import { HelpView } from "./helpView";
@@ -109,12 +109,31 @@ export function activate(context: ExtensionContext) {
});
context.subscriptions.push(openFile);
- // Export to Quarkus or Spring
- const exportOptions = ["Quarkus", "Spring"];
+ // Create application
+ const applicationCommand =
commands.registerCommand("karavan.create-application", (...args: any[]) => {
+ if (rootPath){
+ const defaultRuntime: string =
workspace.getConfiguration().get("camel.runtimes") || '';
+ const runtimeOptions: QuickPickItem [] = [
+ {label: "quarkus", picked: "quarkus" === defaultRuntime},
+ {label: "spring-boot", picked: "spring-boot" ===
defaultRuntime},
+ {label: "camel-main", picked: "camel-main" === defaultRuntime}
+ ];
+ utils.hasApplicationProperties(rootPath).then(hasAP => {
+ if (hasAP){
+ window.showInformationMessage("Folder already contains
application.properties");
+ } else {
+ window.showQuickPick(runtimeOptions, { title: "Select
Runtime", canPickMany: false }).then((value) => {
+ if (value) inputExportGav(value.label)
+ })
+ }
+ })
+ }
+ });
+ context.subscriptions.push(applicationCommand);
+
+ // Export project
const exportCommand = commands.registerCommand("karavan.jbang-export",
(...args: any[]) => {
- window.showQuickPick(exportOptions, { title: "Select Runtime",
canPickMany: false }).then((value) => {
- if (value) inputExportFolder(value, rootPath);
- })
+ inputExportFolder(rootPath);
});
context.subscriptions.push(exportCommand);
@@ -124,18 +143,7 @@ export function activate(context: ExtensionContext) {
// Run project
const runProjectCommand =
commands.registerCommand("karavan.jbang-run-project", (...args: any[]) => {
- console.log("RUN PROJECT")
- utils.getProfiles(rootPath).then(profiles => {
- console.log("profiles", profiles)
- if (profiles && profiles.length > 0) {
- profiles.push("Default");
- window.showQuickPick(profiles, { title: "Select Profile",
canPickMany: false }).then((value) => {
- if (value && rootPath) jbang.camelJbangRun(rootPath, value
!== "Default" ? value : undefined);
- })
- } else {
- if (rootPath) jbang.camelJbangRun(rootPath);
- }
- })
+ if (rootPath) jbang.camelJbangRun(rootPath);
});
context.subscriptions.push(runProjectCommand);
@@ -162,11 +170,12 @@ export function activate(context: ExtensionContext) {
/**
* export into folder
*/
-export async function inputExportFolder(runtime: string, rootPath?: string) {
+export async function inputExportFolder(rootPath?: string) {
window.showInputBox({
- title: "Export project with " + runtime,
+ title: "Export project",
ignoreFocusOut: true,
prompt: "Export folder name",
+ value: "export",
validateInput: (text: string): string | undefined => {
if (!text || text.length === 0) {
return 'Name should not be empty';
@@ -177,7 +186,7 @@ export async function inputExportFolder(runtime: string,
rootPath?: string) {
}).then(folder => {
if (folder && rootPath) {
const fullPath = rootPath + path.sep + folder;
- inputExportGav(runtime.toLowerCase(), folder);
+ jbang.camelJbangExport(fullPath);
}
});
}
@@ -185,7 +194,7 @@ export async function inputExportFolder(runtime: string,
rootPath?: string) {
/**
* export with gav
*/
-export async function inputExportGav(runtime: string, folder: string) {
+export async function inputExportGav(runtime: string) {
window.showInputBox({
title: "Export project with " + runtime,
ignoreFocusOut: true,
@@ -199,7 +208,7 @@ export async function inputExportGav(runtime: string,
folder: string) {
}
}).then(gav => {
if (gav) {
- jbang.camelJbangExport(runtime.toLowerCase(), folder, gav);
+ utils.crateApplicationproperties(runtime, gav)
}
});
}
diff --git a/karavan-vscode/src/jbang.ts b/karavan-vscode/src/jbang.ts
index c34a8bd..f6ea32a 100644
--- a/karavan-vscode/src/jbang.ts
+++ b/karavan-vscode/src/jbang.ts
@@ -23,7 +23,7 @@ import * as utils from "./utils";
const TERMINALS: Map<string, Terminal> = new Map<string, Terminal>();
export async function camelJbangGenerate(rootPath: string, openApiFullPath:
string, fullPath: string, add: boolean, crd?: boolean, generateRoutes?:
boolean) {
- let command = prepareCommand("generate rest -i " + openApiFullPath,
"application"); // TODO: set profile configurable
+ let command = prepareCommand("generate rest -i " + openApiFullPath);
if (generateRoutes === true) command = command + " --routes";
executeJbangCommand(rootPath, command, (code, stdout, stderr) => {
console.log('Exit code:', code);
@@ -63,7 +63,7 @@ export function createYaml(filename: string, restYaml:
string, camelYaml?: strin
}
export function camelJbangPackage(rootPath: string, profile: string, callback:
(code: number) => any) {
- executeJbangCommand(rootPath, prepareCommand("package uber-jar", profile),
(code, stdout, stderr) => callback(code));
+ executeJbangCommand(rootPath, prepareCommand("package uber-jar"), (code,
stdout, stderr) => callback(code));
}
@@ -71,17 +71,16 @@ export function cacheClear(rootPath: string, callback:
(code: number) => any) {
executeJbangCommand(rootPath, "jbang cache clear", (code, stdout, stderr)
=> callback(code));
}
-function prepareCommand(command: string, profile?: string): string {
+function prepareCommand(command: string): string {
const version = workspace.getConfiguration().get("camel.version");
- const p = profile ? " --profile " + profile : "";
- return "jbang -Dcamel.jbang.version=" + version + " camel@apache/camel " +
command + p;
+ return "jbang -Dcamel.jbang.version=" + version + " camel@apache/camel " +
command;
}
-export function camelJbangRun(rootPath: string, profile?: string, filename?:
string) {
+export function camelJbangRun(rootPath: string, filename?: string) {
const maxMessages: number =
workspace.getConfiguration().get("camel.maxMessages") || -1;
const cmd = (filename ? "run " + filename : "run * ") + (maxMessages > -1
? " --max-messages=" + maxMessages : "");
- const command = prepareCommand(cmd, profile);
- const terminalId = "run_" + profile + "_" + filename;
+ const command = prepareCommand(cmd);
+ const terminalId = "run_" + filename;
const existTerminal = TERMINALS.get(terminalId);
if (existTerminal) existTerminal.dispose();
const terminal = window.createTerminal('Camel run: ' + filename ? filename
: "project");
@@ -90,12 +89,10 @@ export function camelJbangRun(rootPath: string, profile?:
string, filename?: str
terminal.sendText(command);
}
-export function camelJbangExport(runtime: string, directory: string, gav:
string) {
- const cmd = "export " + runtime
- + (directory !== undefined ? " --directory=" + directory : "")
- + (gav !== undefined ? " --gav=" + gav : "");
+export function camelJbangExport(directory: string) {
+ const cmd = "export --directory=" + directory;
const command = prepareCommand(cmd);
- const terminalId = "export " + runtime;
+ const terminalId = "export";
const existTerminal = TERMINALS.get(terminalId);
if (existTerminal) existTerminal.dispose();
const terminal = window.createTerminal('Camel export');
diff --git a/karavan-vscode/src/utils.ts b/karavan-vscode/src/utils.ts
index 73f11a5..9ca92e5 100644
--- a/karavan-vscode/src/utils.ts
+++ b/karavan-vscode/src/utils.ts
@@ -17,7 +17,6 @@
import * as path from "path";
import { workspace, Uri, window, ExtensionContext, FileType} from "vscode";
import { CamelDefinitionYaml } from "karavan-core/lib/api/CamelDefinitionYaml";
-import { ProjectModelApi } from "karavan-core/lib/api/ProjectModelApi";
export function save(relativePath: string, text: string) {
if (workspace.workspaceFolders) {
@@ -121,6 +120,10 @@ export async function getYamlFiles(baseDir: string) {
return result;
}
+export async function hasApplicationProperties(baseDir: string) {
+ return (await getPropertyFiles(baseDir)).includes(baseDir + path.sep +
'application.properties');
+}
+
export async function getPropertyFiles(baseDir: string) {
const result: string[] = [];
(await getAllFiles(baseDir, [])).filter(f =>
f.endsWith(".properties")).forEach(f => {
@@ -162,12 +165,6 @@ export async function getProperties(rootPath?: string) {
}
}
-export async function getProfiles(rootPath?: string) {
- const text = await getProperties(rootPath);
- const project = ProjectModelApi.propertiesToProject(text);
- return ProjectModelApi.getProfiles(project.properties);
-}
-
export async function stat(fullPath: string) {
const uriFile: Uri = Uri.file(fullPath);
return workspace.fs.stat(uriFile);
@@ -190,4 +187,26 @@ export async function write(fullPath: string, code:
string) {
value => {},
reason => window.showErrorMessage("Error: " + reason)
);
+}
+
+export async function crateApplicationproperties(runtime: string, gav: string,
) {
+ if (workspace.workspaceFolders) {
+ const uriFolder: Uri = workspace.workspaceFolders[0].uri;
+ const parts = uriFolder.fsPath.split(path.sep);
+ const name = parts.at(parts.length -1) || '';
+
+ const runtimeVersion: string =
workspace.getConfiguration().get("camel." + runtime + "-version") || '';
+ const props: string [] =
workspace.getConfiguration().get("Karavan.applicationProperties") || [];
+ const runtimeDefaults: [] = (runtime === 'quarkus')
+ ?
workspace.getConfiguration().get("Karavan.quarkusApplicationProperties") || []
+ : [];
+ const text = props.concat(runtimeDefaults).map(v => {
+ if (v.includes('$NAME')) return v.replace('$NAME', name)
+ else if (v.includes('$GAV')) return v.replace('$GAV', gav)
+ else if (v.includes('$RUNTIME_VERSION')) return
v.replace('$RUNTIME_VERSION', runtimeVersion) // $RUNTIME_VERSION should be
before $RUNTIME
+ else if (v.includes('$RUNTIME')) return v.replace('$RUNTIME',
runtime)
+ else return v;
+ }).join('\n');
+ write(path.join(uriFolder.path, "application.properties"), text);
+ }
}
\ No newline at end of file
diff --git a/karavan-vscode/webview/kamelets/KameletCard.tsx
b/karavan-vscode/webview/kamelets/KameletCard.tsx
index 31ac3c6..2bae9fc 100644
--- a/karavan-vscode/webview/kamelets/KameletCard.tsx
+++ b/karavan-vscode/webview/kamelets/KameletCard.tsx
@@ -16,7 +16,7 @@
*/
import React from 'react';
import {
- CardHeader, Card, CardTitle, CardBody, CardActions, CardFooter,Badge
+ CardHeader, Card, CardTitle, CardBody, CardFooter,Badge
} from '@patternfly/react-core';
import '../designer/karavan.css';
import {KameletModel} from "karavan-core/lib/model/KameletModels";