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 6f2f7cf Fixed #79 (#88) 6f2f7cf is described below commit 6f2f7cf1b86677785f193a08747b2ca2fea48628 Author: Marat Gubaidullin <marat.gubaidul...@gmail.com> AuthorDate: Fri Nov 12 20:49:00 2021 -0500 Fixed #79 (#88) --- .../src/main/resources/application.properties | 2 +- karavan-app/src/main/webapp/src/Main.tsx | 22 +++++++++------ .../main/webapp/src/integrations/DesignerPage.tsx | 6 ++-- .../webapp/src/integrations/IntegrationCard.tsx | 4 +-- .../webapp/src/integrations/IntegrationPage.tsx | 32 ++++++++++++++++------ 5 files changed, 43 insertions(+), 23 deletions(-) diff --git a/karavan-app/src/main/resources/application.properties b/karavan-app/src/main/resources/application.properties index 14a6625..0c59944 100644 --- a/karavan-app/src/main/resources/application.properties +++ b/karavan-app/src/main/resources/application.properties @@ -1,4 +1,4 @@ -karavan.version=0.0.3 +karavan.version=0.0.6 karavan.folder.kamelets=kamelets karavan.folder.components=components diff --git a/karavan-app/src/main/webapp/src/Main.tsx b/karavan-app/src/main/webapp/src/Main.tsx index 94bf84f..ed33daf 100644 --- a/karavan-app/src/main/webapp/src/Main.tsx +++ b/karavan-app/src/main/webapp/src/Main.tsx @@ -117,8 +117,9 @@ export class Main extends React.Component<Props, State> { toolBar = (version: string) => ( <div className="top-toolbar"> - <Flex direction={{default: "row"}} justifyContent={{default: "justifyContentSpaceBetween"}} style={{width:"100%"}}> - <FlexItem style={{marginTop: "auto", marginBottom:"auto"}}> + <Flex direction={{default: "row"}} justifyContent={{default: "justifyContentSpaceBetween"}} + style={{width: "100%"}}> + <FlexItem style={{marginTop: "auto", marginBottom: "auto"}}> <Flex direction={{default: "row"}}> <FlexItem> <TextContent> @@ -132,7 +133,7 @@ export class Main extends React.Component<Props, State> { </FlexItem> </Flex> </FlexItem> - <FlexItem style={{marginTop: "auto", marginBottom:"auto"}}> + <FlexItem style={{marginTop: "auto", marginBottom: "auto"}}> <PageHeaderTools> <PageHeaderToolsGroup> <PageHeaderToolsItem> @@ -142,9 +143,11 @@ export class Main extends React.Component<Props, State> { <Dropdown isPlain position="right" - onSelect={event => {}} + onSelect={event => { + }} isOpen={false} - toggle={<DropdownToggle onToggle={isOpen => {}}>cameleer</DropdownToggle>} + toggle={<DropdownToggle onToggle={isOpen => { + }}>cameleer</DropdownToggle>} // dropdownItems={userDropdownItems} /> </PageHeaderToolsItem> @@ -208,11 +211,11 @@ export class Main extends React.Component<Props, State> { this.setState({alerts: mess}) } - onIntegrationSelect = (name: string) => { - KaravanApi.getIntegration(name, res => { + onIntegrationSelect = (filename: string) => { + KaravanApi.getIntegration(filename, res => { if (res.status === 200) { const code: string = res.data; - const i = CamelYaml.yamlToIntegration(code); + const i = CamelYaml.yamlToIntegration(filename, code); this.setState({isNavOpen: false, pageId: 'designer', integration: i}); } else { this.toast("Error", res.statusText, "danger"); @@ -241,7 +244,8 @@ export class Main extends React.Component<Props, State> { onCreate={this.onIntegrationCreate}/>} {this.state.pageId === 'configuration' && <ConfigurationPage/>} {this.state.pageId === 'kamelets' && <KameletsPage/>} - {this.state.pageId === 'designer' && <DesignerPage mode={this.state.mode} integration={this.state.integration}/>} + {this.state.pageId === 'designer' && + <DesignerPage mode={this.state.mode} integration={this.state.integration}/>} <Modal title="Confirmation" variant={ModalVariant.small} diff --git a/karavan-app/src/main/webapp/src/integrations/DesignerPage.tsx b/karavan-app/src/main/webapp/src/integrations/DesignerPage.tsx index cfd2e3e..48ad968 100644 --- a/karavan-app/src/main/webapp/src/integrations/DesignerPage.tsx +++ b/karavan-app/src/main/webapp/src/integrations/DesignerPage.tsx @@ -40,7 +40,7 @@ export class DesignerPage extends React.Component<Props, State> { } post = () => { - KaravanApi.postIntegrations(this.state.integration.metadata.name + ".yaml", this.state.yaml, res => { + KaravanApi.postIntegrations(this.state.integration.metadata.name, this.state.yaml, res => { if (res.status === 200) { console.log(res) //TODO show notification } else { @@ -50,7 +50,7 @@ export class DesignerPage extends React.Component<Props, State> { } publish = () => { - KaravanApi.publishIntegration(this.state.integration.metadata.name + ".yaml", this.state.yaml, res => { + KaravanApi.publishIntegration(this.state.integration.metadata.name, this.state.yaml, res => { if (res.status === 200) { console.log(res) //TODO show notification } else { @@ -131,7 +131,7 @@ export class DesignerPage extends React.Component<Props, State> { <KaravanDesigner dark={false} key={this.state.key} - name={this.state.name} + filename={this.state.name} yaml={this.state.yaml} onSave={(name, yaml) => this.save(name, yaml)} borderColor="#fb8824" diff --git a/karavan-app/src/main/webapp/src/integrations/IntegrationCard.tsx b/karavan-app/src/main/webapp/src/integrations/IntegrationCard.tsx index 27273e3..4467772 100644 --- a/karavan-app/src/main/webapp/src/integrations/IntegrationCard.tsx +++ b/karavan-app/src/main/webapp/src/integrations/IntegrationCard.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { - CardHeader, Card, CardTitle, CardBody, Button, CardActions, + CardHeader, Card, CardTitle, CardBody, Button, CardActions, CardFooter, } from '@patternfly/react-core'; import DeleteIcon from "@patternfly/react-icons/dist/js/icons/times-icon"; import '../designer/karavan.css'; @@ -46,4 +46,4 @@ export class IntegrationCard extends React.Component<Props, State> { </Card> ); } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/karavan-app/src/main/webapp/src/integrations/IntegrationPage.tsx b/karavan-app/src/main/webapp/src/integrations/IntegrationPage.tsx index 091ebf4..3442629 100644 --- a/karavan-app/src/main/webapp/src/integrations/IntegrationPage.tsx +++ b/karavan-app/src/main/webapp/src/integrations/IntegrationPage.tsx @@ -8,7 +8,7 @@ import { PageSection, TextContent, Text, - Button, Modal, FormGroup, ModalVariant + Button, Modal, FormGroup, ModalVariant, Switch, Form } from '@patternfly/react-core'; import '../designer/karavan.css'; import {IntegrationCard} from "./IntegrationCard"; @@ -16,6 +16,8 @@ import {MainToolbar} from "../MainToolbar"; import RefreshIcon from '@patternfly/react-icons/dist/esm/icons/sync-alt-icon'; import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon'; import {Integration} from "../designer/model/CamelModel"; +import {CamelApi} from "../designer/api/CamelApi"; +import {CamelUi} from "../designer/api/CamelUi"; interface Props { integrations: [] @@ -31,6 +33,7 @@ interface State { integrations: [], isModalOpen: boolean, newName: string + crd: boolean } export class IntegrationPage extends React.Component<Props, State> { @@ -40,7 +43,8 @@ export class IntegrationPage extends React.Component<Props, State> { path: '', integrations: this.props.integrations, isModalOpen: false, - newName: '' + newName: '', + crd: true }; tools = () => (<Toolbar id="toolbar-group-types"> @@ -66,7 +70,9 @@ export class IntegrationPage extends React.Component<Props, State> { this.setState({isModalOpen:false, newName:""}); } saveAndCloseModal = () => { - const i = Integration.createNew(this.state.newName); + const name = CamelUi.nameFromTitle(this.state.newName) + ".yaml"; + const i = Integration.createNew(name); + i.crd = this.state.crd; this.props.onCreate.call(this, i); this.setState({isModalOpen:false, newName:""}); } @@ -93,11 +99,21 @@ export class IntegrationPage extends React.Component<Props, State> { <Button key="cancel" variant="secondary" onClick={this.closeModal}>Cancel</Button> ]} > - <FormGroup label="Title" fieldId="title" isRequired> - <TextInput className="text-field" type="text" id="title" name="title" - value={this.state.newName} - onChange={e => this.setState({newName: e})}/> - </FormGroup> + <Form isHorizontal={true}> + <FormGroup label="Title" fieldId="title" isRequired> + <TextInput className="text-field" type="text" id="title" name="title" + value={this.state.newName} + onChange={e => this.setState({newName: e})}/> + </FormGroup> + <FormGroup label="CRD" fieldId="crd" isRequired> + <Switch + id="crd" name="crd" + value={this.state.crd.toString()} + aria-label="crd" + isChecked={this.state.crd} + onChange={e => this.setState({crd: e})}/> + </FormGroup> + </Form> </Modal> </PageSection> );