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 8862565  Fix #607
8862565 is described below

commit 8862565b4f57129505be1003c4d9e88976eba783
Author: Marat Gubaidullin <[email protected]>
AuthorDate: Fri Jan 13 11:41:17 2023 -0500

    Fix #607
---
 .../src/main/webui/src/designer/beans/BeansDesigner.tsx |  2 +-
 .../src/main/webui/src/designer/rest/RestDesigner.tsx   | 16 ++++++++--------
 .../src/main/webui/src/designer/route/RouteDesigner.tsx |  4 ++--
 .../designer/route/property/ComponentParameterField.tsx |  1 -
 .../src/designer/route/property/DslPropertyField.tsx    | 17 ++++++++++++-----
 .../src/main/webui/src/projects/CreateFileModal.tsx     |  2 ++
 karavan-app/src/main/webui/src/projects/ProjectPage.tsx |  2 +-
 7 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/karavan-app/src/main/webui/src/designer/beans/BeansDesigner.tsx 
b/karavan-app/src/main/webui/src/designer/beans/BeansDesigner.tsx
index d48ea68..037df83 100644
--- a/karavan-app/src/main/webui/src/designer/beans/BeansDesigner.tsx
+++ b/karavan-app/src/main/webui/src/designer/beans/BeansDesigner.tsx
@@ -148,7 +148,7 @@ export class BeansDesigner extends React.Component<Props, 
State> {
                                                 variant={beans?.length === 0 ? 
"primary" : "secondary"}
                                                 data-click="ADD_REST"
                                                 icon={<PlusIcon/>}
-                                                onClick={e => 
this.createBean()}>Create new bean
+                                                onClick={e => 
this.createBean()}>Create bean
                                             </Button>
                                         </div>
                                     </div>
diff --git a/karavan-app/src/main/webui/src/designer/rest/RestDesigner.tsx 
b/karavan-app/src/main/webui/src/designer/rest/RestDesigner.tsx
index 13fd96a..f91c512 100644
--- a/karavan-app/src/main/webui/src/designer/rest/RestDesigner.tsx
+++ b/karavan-app/src/main/webui/src/designer/rest/RestDesigner.tsx
@@ -263,20 +263,20 @@ export class RestDesigner extends React.Component<Props, 
State> {
                                         {config && 
this.getRestConfigurationCard(config)}
                                         {data && this.getRestCards(data)}
                                         <div className="add-rest">
+                                            <Button
+                                                variant={data?.length === 0 ? 
"primary" : "secondary"}
+                                                data-click="ADD_REST"
+                                                icon={<PlusIcon/>}
+                                                onClick={e => 
this.createRest()}>Create service
+                                            </Button>
                                             {config === undefined &&
                                                 <Button
-                                                    variant="primary"
+                                                    variant="secondary"
                                                     
data-click="ADD_REST_REST_CONFIG"
                                                     icon={<PlusIcon/>}
-                                                    onClick={e => 
this.createRestConfiguration()}>Create REST Configuration
+                                                    onClick={e => 
this.createRestConfiguration()}>Create configuration
                                                 </Button>
                                             }
-                                            <Button
-                                                variant={data?.length === 0 ? 
"primary" : "secondary"}
-                                                data-click="ADD_REST"
-                                                icon={<PlusIcon/>}
-                                                onClick={e => 
this.createRest()}>Create REST Service
-                                            </Button>
                                         </div>
                                     </div>
                                 </div>
diff --git a/karavan-app/src/main/webui/src/designer/route/RouteDesigner.tsx 
b/karavan-app/src/main/webui/src/designer/route/RouteDesigner.tsx
index 01c02f7..949295e 100644
--- a/karavan-app/src/main/webui/src/designer/route/RouteDesigner.tsx
+++ b/karavan-app/src/main/webui/src/designer/route/RouteDesigner.tsx
@@ -410,12 +410,12 @@ export class RouteDesigner extends React.Component<Props, 
State> {
                         <Button
                             variant={routes.length === 0 ? "primary" : 
"secondary"}
                             icon={<PlusIcon/>}
-                            onClick={e => this.openSelector(undefined, 
undefined)}>Create new route
+                            onClick={e => this.openSelector(undefined, 
undefined)}>Create route
                         </Button>
                         <Button
                             variant="secondary"
                             icon={<PlusIcon/>}
-                            onClick={e => 
this.createRouteConfiguration()}>Create new configuration
+                            onClick={e => 
this.createRouteConfiguration()}>Create configuration
                         </Button>
                     </div>
                 </div>
diff --git 
a/karavan-app/src/main/webui/src/designer/route/property/ComponentParameterField.tsx
 
b/karavan-app/src/main/webui/src/designer/route/property/ComponentParameterField.tsx
index 7c9ce9d..67dd816 100644
--- 
a/karavan-app/src/main/webui/src/designer/route/property/ComponentParameterField.tsx
+++ 
b/karavan-app/src/main/webui/src/designer/route/property/ComponentParameterField.tsx
@@ -289,7 +289,6 @@ export class ComponentParameterField extends 
React.Component<Props, State> {
         const property: ComponentProperty = this.props.property;
         const value = this.props.value;
         const id = prefix + "-" + property.name;
-        console.log("property", property)
         return (
             <FormGroup
                 key={id}
diff --git 
a/karavan-app/src/main/webui/src/designer/route/property/DslPropertyField.tsx 
b/karavan-app/src/main/webui/src/designer/route/property/DslPropertyField.tsx
index a05575f..8b9b57a 100644
--- 
a/karavan-app/src/main/webui/src/designer/route/property/DslPropertyField.tsx
+++ 
b/karavan-app/src/main/webui/src/designer/route/property/DslPropertyField.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, {ReactElement} from 'react';
 import {
     FormGroup,
     TextInput,
@@ -410,10 +410,17 @@ export class DslPropertyField extends 
React.Component<Props, State> {
         )
     }
 
-    getMediaTypeSelectOptions(filter?: string) {
-        return filter
-            ? MediaTypes.filter(mt => mt.includes(filter)).map((value: string) 
=> <SelectOption key={value} value={value.trim()}/>)
-            : MediaTypes.map((value: string) => <SelectOption key={value} 
value={value.trim()}/>);
+    getMediaTypeSelectOptions(filter?: string): JSX.Element [] {
+        const options: JSX.Element [] = [
+            <SelectOption key={0} value="Select Media Type" isPlaceholder />
+        ];
+        const mediaTypes: JSX.Element[] =  filter
+            ? MediaTypes.filter(mt => mt.includes(filter)).map((value: string) 
=>
+                <SelectOption key={value} value={value.trim()}/>)
+            : MediaTypes.map((value: string) =>
+                <SelectOption key={value} value={value.trim()}/>);
+        options.push(...mediaTypes);
+        return options;
     }
 
     getMediaTypeSelect = (property: PropertyMeta, value: any) => {
diff --git a/karavan-app/src/main/webui/src/projects/CreateFileModal.tsx 
b/karavan-app/src/main/webui/src/projects/CreateFileModal.tsx
index 90183a0..9101d9a 100644
--- a/karavan-app/src/main/webui/src/projects/CreateFileModal.tsx
+++ b/karavan-app/src/main/webui/src/projects/CreateFileModal.tsx
@@ -61,6 +61,8 @@ export class CreateFileModal extends React.Component<Props, 
State> {
     render() {
         const {fileType} = this.state;
         const {types} = this.props;
+        console.log(fileType)
+        console.log(types)
         const extension = ProjectFileTypes.filter(value => value.name === 
fileType)[0].extension;
         const filename = (extension !== 'java')
             ? CamelUi.nameFromTitle(this.state.name)
diff --git a/karavan-app/src/main/webui/src/projects/ProjectPage.tsx 
b/karavan-app/src/main/webui/src/projects/ProjectPage.tsx
index 1ebf251..d316e44 100644
--- a/karavan-app/src/main/webui/src/projects/ProjectPage.tsx
+++ b/karavan-app/src/main/webui/src/projects/ProjectPage.tsx
@@ -443,7 +443,7 @@ export class ProjectPage extends React.Component<Props, 
State> {
         const {file, isDeleteModalOpen, fileToDelete, isUploadModalOpen, 
isCreateModalOpen, key} = this.state;
         const {project} = this.props;
         const types = this.isBuildIn()
-            ? (this.isKameletsProject() ? ['KAMELET'] : ['JAVA'])
+            ? (this.isKameletsProject() ? ['KAMELET'] : ['CODE', 'PROPERTIES'])
             : ProjectFileTypes.filter(p => !['PROPERTIES', 'LOG', 
'KAMELET'].includes(p.name)).map(p => p.name);
         return (
             <PageSection key={key} className="kamelet-section project-page" 
padding={{default: 'noPadding'}}>

Reply via email to