Skip to content

Commit

Permalink
Merge pull request #71 from jGauravGupta/FISH-9548-2
Browse files Browse the repository at this point in the history
FISH-9548 Added placeholder/tooltip added to UI components and Source Editor focused
  • Loading branch information
jGauravGupta authored Oct 10, 2024
2 parents 2644404 + fe6c3b5 commit 7a998db
Show file tree
Hide file tree
Showing 37 changed files with 147 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
/starter-archetype/payara-starter-archetype.iml
/starter-archetype/src/main/resources/archetype-resources/.gradle
/starter-ui/payara-starter-ui.iml
/PayaraStarterGenerator/target/
/starter-generator/target/
starter-ui/nb-configuration.xml
starter-ui/nb-configuration.xml
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<modules>
<module>starter-archetype</module>
<module>starter-ui</module>
<module>PayaraStarterGenerator</module>
<module>starter-generator</module>
</modules>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ def mpOpenAPI = request.properties["mpOpenAPI"].trim()
def mpFaultTolerance = request.properties["mpFaultTolerance"].trim()
def mpMetrics = request.properties["mpMetrics"].trim()
def auth = request.properties["auth"].trim()
def erDiagram = request.properties["erDiagram"].trim()

def outputDirectory = new File(request.getOutputDirectory(), request.getArtifactId())

validateInput(profile, jakartaEEVersion, javaVersion, platform, outputDirectory)
generateSource(build, _package, platform, jakartaEEVersion, includeTests, docker, mpConfig, mpOpenAPI, auth, outputDirectory)
bindEEPackage(jakartaEEVersion, mpConfig, mpOpenAPI, mpFaultTolerance, mpMetrics, auth, outputDirectory)
bindEEPackage(jakartaEEVersion, mpConfig, mpOpenAPI, mpFaultTolerance, mpMetrics, auth, erDiagram, outputDirectory)

private void validateInput(String profile, String jakartaEEVersion, String javaVersion, String platform, File outputDirectory) {
boolean deleteDirectory = true;
Expand Down Expand Up @@ -136,15 +137,16 @@ private generateSource(build, _package, platform, jakartaEEVersion,
}
}

private void bindEEPackage(String jakartaEEVersion, String mpConfig, String mpOpenAPI, String mpFaultTolerance, String mpMetrics, String auth, File outputDirectory) {
private void bindEEPackage(String jakartaEEVersion, String mpConfig, String mpOpenAPI, String mpFaultTolerance, String mpMetrics, String auth, String erDiagram, File outputDirectory) {
def eePackage = (jakartaEEVersion == '8') ? 'javax' : 'jakarta'
println "Binding EE package: $eePackage"

def binding = [eePackage: eePackage, \
'mpConfig': mpConfig.toBoolean(), 'mpOpenAPI': mpOpenAPI.toBoolean(), 'mpFaultTolerance': mpFaultTolerance.toBoolean(), 'mpMetrics': mpMetrics.toBoolean(),
'formAuthFileRealm': auth.equals("formAuthFileRealm"),
'formAuthDB': auth.equals("formAuthDB"),
'formAuthLDAP': auth.equals("formAuthLDAP")
'formAuthLDAP': auth.equals("formAuthLDAP"),
'erDiagram': erDiagram.toBoolean()
]
def engine = new SimpleTemplateEngine()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
<defaultValue>none</defaultValue>
<validationRegex>^(none|formAuthFileRealm|formAuthDB|formAuthLDAP)$</validationRegex>
</requiredProperty>
<requiredProperty key="erDiagram">
<defaultValue>false</defaultValue>
<validationRegex>^(false|true)$</validationRegex>
</requiredProperty>
<requiredProperty key="erDiagramName">
<defaultValue></defaultValue>
</requiredProperty>
</requiredProperties>

<fileSets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,25 @@
</head>
<body>


<h1>Greetings from Payara!</h1>
<p>
Thank you for visiting <a href="https://www.payara.fish/">Payara</a>! We're thrilled to have you here. Payara is your go-to destination for all things Jakarta EE and Java enterprise applications.
</p>
<p>
<a href="https://www.payara.fish/"><img width="50%" src="images/payara-fish-logo.svg" alt="Payara Logo"></a>
</p>

<% if (erDiagram) { %>
<h2>${erDiagramName} Home Page</h2>
<p>
To manage the ${erDiagramName}, visit the home page:
<a href="main.html">Main Page</a>.
</p>
<% } %>
<h2>RESTful Service</h2>
<p>
The REST end-point is available at <a href="resources/hello">resources/hello</a>.
You can supply a name to the end-point using a query parameter like this: <a href="resources/hello?name=John">resources/hello?name=John</a>
</p>

<% if (formAuthFileRealm || formAuthDB || formAuthLDAP) { %>
<h2>Secure Pages</h2>
<p>
Expand All @@ -50,7 +54,6 @@ <h2>Secured RESTful Endpoints</h2>
<li><a href="resources/admin">Secured Admin Resource</a></li>
</ul>
<% } %>

<% if (mpOpenAPI) { %>
<h2>API Documentation</h2>
<p>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public class ApplicationConfiguration {
public static final String DEPLOY_WAR = "deployWar";
public static final String CONTEXT_ROOT = "contextRoot";
public static final String AUTH = "auth";
public static final String ENTITIES = "entities";
public static final String ER_DIAGRAM = "erDiagram";
public static final String ER_DIAGRAM_NAME = "erDiagramName";

public static final String PAYARA_VERSION_6_2023_11 = "6.2023.11";

Expand Down Expand Up @@ -157,9 +158,13 @@ public class ApplicationConfiguration {

@JsonbProperty(AUTH)
private String auth = "none";


@JsonbProperty(ER_DIAGRAM)
private String erDiagram = null;

@JsonbProperty(ER_DIAGRAM_NAME)
private String erDiagramName = null;

private boolean generateJPA = true;
private boolean generateRepository = true;
private boolean generateRest = true;
Expand Down Expand Up @@ -396,6 +401,14 @@ public void setErDiagram(String erDiagram) {
this.erDiagram = erDiagram;
}

public String getErDiagramName() {
return erDiagramName;
}

public void setErDiagramName(String erDiagramName) {
this.erDiagramName = erDiagramName;
}

public boolean isGenerateJPA() {
return generateJPA;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ public Future<File> generate(ApplicationConfiguration appProperties) {
ERDiagramParser parser = new ERDiagramParser();
erModel = parser.parse(appProperties.getErDiagram());
if (erModel != null && !erModel.getEntities().isEmpty()) {
properties.put(ApplicationConfiguration.ENTITIES, appProperties.getAuth());
properties.put(ApplicationConfiguration.ER_DIAGRAM, true);
properties.put(ApplicationConfiguration.ER_DIAGRAM_NAME, appProperties.getErDiagramName());
}
}
invokeMavenArchetype(ARCHETYPE_GROUP_ID, ARCHETYPE_ARTIFACT_ID, ARCHETYPE_VERSION,
Expand All @@ -136,11 +137,10 @@ public Future<File> generate(ApplicationConfiguration appProperties) {
if (erModel != null && !erModel.getEntities().isEmpty()) {
Jsonb jsonb = JsonbBuilder.create();
String jsonString = jsonb.toJson(erModel);
LOGGER.info("Generating web components info from AI.");
String outputJson = langChainChatService.addFronEndDetailsToERDiagram(jsonString);
if (outputJson != null && !outputJson.isEmpty()) {
String updatedJson = outputJson.strip().replaceAll("^```json|```$", "");
// convert json to ERModel

erModel = jsonb.fromJson(updatedJson, ERModel.class);
}
CRUDAppGenerator generator = new CRUDAppGenerator(erModel,
Expand Down
5 changes: 4 additions & 1 deletion starter-ui/src/main/webapp/assets/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ form.addEventListener('submit', function (event) {
}
} else {
jsonObject[key] = input.value;
if(input.id == 'erDiagram' && !$("#mermaidErDiagramList").val()) {
jsonObject[key] = '';
}
}
});

Expand All @@ -118,7 +121,7 @@ form.addEventListener('submit', function (event) {
},
body: JSON.stringify(jsonObject),
};
debugger;

fetch('resources/starter', requestOptions)
.then(response => {
if (response.status === 200) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,4 @@ erDiagram
int adminId PK
string name
string role
}
%%{ icon[card],title[Membership Management System],home-page-description[A system for managing membership registrations and benefits. Track members, subscriptions, and privileges efficiently.],about-us-page-description[Explore our membership management system and discover exclusive benefits for our members. Connect with other members and stay updated with our events and notifications.],menu[Home, Memberships, Benefits, About Us, Contact
}
Loading

0 comments on commit 7a998db

Please sign in to comment.