Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DON'T MERGE] feat(Form): Introduce Kaoto Form V2 #1939

Draft
wants to merge 36 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c4a47bd
feat(Form): Support anyOf & oneOf
lordrip Jan 15, 2025
dd8b695
feat(Form): support PasswordField
tplevko Jan 24, 2025
0f4f3de
chore: Show `DisabledField` for ArrayFields
lordrip Jan 24, 2025
c1768f4
chore: Add omitFields support
lordrip Jan 24, 2025
67e6108
fix(CanvasForm): Avoid rerender CanvasForm
lordrip Jan 24, 2025
82c9ba7
feat(Form): Give priority to matching model and schema types
lordrip Jan 27, 2025
0537777
chore: Fix lint and build
lordrip Jan 27, 2025
99c0ee2
feat(Form): Clean current schema after switching to another schema
lordrip Jan 27, 2025
db748e9
feat(Form): Add ArrayField
lordrip Jan 27, 2025
7187d84
Feat: Added new EIPGenerator
lordrip Jan 15, 2025
ac1589d
chore: Improve single property schema naming
lordrip Jan 28, 2025
959c7a4
feat(Catalog): Remove simple string schemas in favor of complex ones
lordrip Jan 28, 2025
1887151
feat(Catalog): Add CamelCatalogSchemaEnhancer
lordrip Jan 28, 2025
3d472d8
chore(tests): Cache JavaType to Camel model map
lordrip Jan 29, 2025
cac8fd7
feat(Catalog): Add group/label information
lordrip Jan 29, 2025
415259e
Fix(EIP_Generator): Sorting root properties and definitions propertie…
shivamG640 Jan 29, 2025
f49c23e
Fix(Catalog): Restrict group information for empty EIP properties
shivamG640 Jan 29, 2025
221d9f4
feat(Form): Add EnumField
tplevko Jan 30, 2025
fb59491
Fix(Catalog): Add Bean information on EIP Properties
shivamG640 Jan 30, 2025
048487c
chore: extract capitalize functionality to separate function
lordrip Jan 31, 2025
5bc2ef8
feat(Form): Add property filtering and grouping
lordrip Jan 31, 2025
0d99f02
feat(Form): Add PropertiesField component
lordrip Feb 3, 2025
d260fac
feat(Form): add outside of list values and placeholders to typeahead …
tplevko Jan 31, 2025
f6d3d3a
feat(Form): Add TextAreaField
lordrip Feb 3, 2025
23d140f
Feat(Catalog): Added Component Generator
shivamG640 Feb 3, 2025
239d34d
feat(Form): Generate object fields lazily
lordrip Feb 4, 2025
f5034fb
Fix(Catalog): Added Schema details to EIPS and Components
shivamG640 Feb 4, 2025
2d3eba8
feat(Form): Extract FieldWrapper field and increase text size
lordrip Feb 5, 2025
2605f6a
Fix(Catalog): Added Rest Definitions to Patterns catalog
shivamG640 Feb 5, 2025
5129127
fix(Canvas): base canBeDisabled functionality in the Processor catalog
lordrip Feb 6, 2025
769d7b0
Feat(Catalog): Added new Entity Generator
shivamG640 Feb 7, 2025
245e10a
chore: rework beans access schema
lordrip Feb 7, 2025
29967d7
Fix: Fix Commit
shivamG640 Feb 8, 2025
f9f4347
Fix: Fix Commit
shivamG640 Feb 8, 2025
e253fff
chore(Canvas): Add routeConfiguration branches
lordrip Feb 10, 2025
1bd26bb
Fix(Catalog): Remove the 'from' propertySchema in model catalog
Feb 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.kaoto.camelcatalog.generators.ComponentGenerator;
import io.kaoto.camelcatalog.generators.EIPGenerator;
import io.kaoto.camelcatalog.generators.EntityGenerator;
import io.kaoto.camelcatalog.maven.CamelCatalogVersionLoader;
import io.kaoto.camelcatalog.model.CatalogRuntime;
import org.apache.camel.catalog.CamelCatalog;
import org.apache.camel.tooling.model.ComponentModel;
Expand Down Expand Up @@ -49,16 +53,19 @@ public class CamelCatalogProcessor {
private final ObjectMapper jsonMapper;
private final CamelCatalog camelCatalog;
private final CamelYamlDslSchemaProcessor schemaProcessor;
private final CamelCatalogVersionLoader camelCatalogVersionLoader;
private final CatalogRuntime runtime;
private final boolean verbose;

public CamelCatalogProcessor(CamelCatalog camelCatalog, ObjectMapper jsonMapper,
CamelYamlDslSchemaProcessor schemaProcessor, CatalogRuntime runtime, boolean verbose) {
CamelYamlDslSchemaProcessor schemaProcessor, CatalogRuntime runtime,
boolean verbose, CamelCatalogVersionLoader camelCatalogVersionLoader) {
this.jsonMapper = jsonMapper;
this.camelCatalog = camelCatalog;
this.schemaProcessor = schemaProcessor;
this.runtime = runtime;
this.verbose = verbose;
this.camelCatalogVersionLoader = camelCatalogVersionLoader;
}

/**
Expand All @@ -68,12 +75,15 @@ public CamelCatalogProcessor(CamelCatalog camelCatalog, ObjectMapper jsonMapper,
*/
public Map<String, String> processCatalog() throws Exception {
var answer = new LinkedHashMap<String, String>();
var componentCatalog = getComponentCatalog();
ComponentGenerator componentGenerator = new ComponentGenerator(camelCatalog);
var componentCatalog = Util.getPrettyJSON(componentGenerator.generate());
var dataFormatCatalog = getDataFormatCatalog();
var languageCatalog = getLanguageCatalog();
var modelCatalog = getModelCatalog();
var patternCatalog = getPatternCatalog();
var entityCatalog = getEntityCatalog();
EIPGenerator eipGenerator = new EIPGenerator(camelCatalog, camelCatalogVersionLoader.getCamelYamlDslSchema());
var patternCatalog = Util.getPrettyJSON(eipGenerator.generate());
EntityGenerator entityGenerator = new EntityGenerator(camelCatalog, camelCatalogVersionLoader.getCamelYamlDslSchema());
var entityCatalog = Util.getPrettyJSON(entityGenerator.generate());
var loadBalancerCatalog = getLoadBalancerCatalog();
answer.put("components", componentCatalog);
answer.put("dataformats", dataFormatCatalog);
Expand Down Expand Up @@ -287,11 +297,7 @@ public String getModelCatalog() throws Exception {
var model = (EipModel) camelCatalog.model(Kind.eip, name);
var json = JsonMapper.asJsonObject(model).toJson();
var catalogNode = (ObjectNode) jsonMapper.readTree(json);
if ("from".equals(name)) {
// "from" is an exception that is not a processor, therefore it's not in the
// pattern catalog - put the propertiesSchema here
generatePropertiesSchema(catalogNode);
}

answer.set(name, catalogNode);
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CamelYamlDSLKeysComparator implements Comparator<String> {

private final List<EipOptionModel> eipOptions;

CamelYamlDSLKeysComparator(List<EipOptionModel> eipOptions) {
public CamelYamlDSLKeysComparator(List<EipOptionModel> eipOptions) {
this.eipOptions = eipOptions;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ private CamelYamlDslSchemaProcessor processCamelSchema(CatalogDefinition index)

private void processCatalog(CamelYamlDslSchemaProcessor schemaProcessor, CatalogDefinition index) {
var catalogProcessor = new CamelCatalogProcessor(camelCatalogVersionLoader.getCamelCatalog(), jsonMapper,
schemaProcessor, catalogGeneratorBuilder.getRuntime(), catalogGeneratorBuilder.isVerbose());
schemaProcessor, catalogGeneratorBuilder.getRuntime(),
catalogGeneratorBuilder.isVerbose(), camelCatalogVersionLoader);
try {
var catalogMap = catalogProcessor.processCatalog();
catalogMap.forEach((name, catalog) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,20 @@
*/
package io.kaoto.camelcatalog.generator;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.node.ObjectNode;

import java.io.IOException;
import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;

public class Util {
private static final ObjectMapper jsonMapper = new ObjectMapper();
public static String generateHash(byte[] content) throws Exception {
if (content == null)
return null;
Expand All @@ -45,4 +54,12 @@ public static String getNormalizedFolder(String folder) {

return absolutePath.toString();
}

public static String getPrettyJSON(Object node) throws IOException {
StringWriter writer = new StringWriter();
try (var jsonGenerator = new JsonFactory().createGenerator(writer).useDefaultPrettyPrinter()) {
jsonMapper.writeTree(jsonGenerator, jsonMapper.valueToTree(node));
}
return writer.toString();
}
}
Loading
Loading