Skip to content

Commit

Permalink
Merge pull request #448 from fangjian0423/main
Browse files Browse the repository at this point in the history
Support azure container apps
  • Loading branch information
jdubois authored Nov 21, 2024
2 parents 4fb8cda + 050d5f4 commit 8d6ba62
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install -g generator-jhipster generator-jhipster-azure-spring-apps@latest"
"postCreateCommand": "npm install -g generator-jhipster generator-jhipster-azure-container-apps@latest"

// Configure tool-specific properties.
// "customizations": {},
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN \

USER root
RUN \
npm install -g generator-jhipster-azure-spring-apps
npm install -g generator-jhipster-azure-container-apps

ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
JHIPSTER_SLEEP=0 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<div class="row" generator-header>
<div class="col-md-12">
<div class="alert alert-info" role="alert">
<p>Generated applications can be deployed on <a href="https://azure.microsoft.com/products/spring-apps/" target="_blank">Azure Spring Apps</a> in a few easy steps, please refer to the readme file in the generated project for the deployment guide.</p>
<p>Detailed documentation is also available <a href="https://learn.microsoft.com/azure/spring-apps/quickstart-deploy-web-app?pivots=sc-consumption-plan&tabs=Azure-Developer-CLI" target="_blank">here</a>.</p>
<p>Generated applications can be deployed on <a href="https://azure.microsoft.com/products/container-apps/" target="_blank">Azure Container Apps</a> in a few easy steps, please refer to the readme file in the generated project for the deployment guide.</p>
<p>Detailed documentation is also available <a href="https://learn.microsoft.com/azure/container-apps" target="_blank">here</a>.</p>
</div>
</div>
<div class="col-md-12">
Expand All @@ -15,7 +15,7 @@
<p>Please note that the current version of this form only supports the following selections within NubesGen:</p>
<ul>
<li>Application Type: <b>Spring Boot Application</b></li>
<li>Database: <b>Azure Database for PostgreSQL</b></li>
<li>Database: <b>Azure Database for PostgreSQL</b> and <b>Azure Cosmos DB</b></li>
</ul>
<p>
Services, Databases and selections not listed above are currently not supported and code will not be generated by this form if provisioned within NubesGen.
Expand All @@ -32,7 +32,7 @@ <h4>More details</h4>
<b>Maven</b> will be the build tool used for the project.<br>
<b>React</b> will be the default front-end framework used for the project.<br>
<b>PostgreSQL</b> will default to passwordless database connections as it's more secure option.<br>
The blueprint <a href="https://github.com/Azure/generator-jhipster-azure-spring-apps"><b>generator-jhipster-azure-spring-apps</b></a> will be added.<br>
The blueprint <a href="https://github.com/Azure/generator-jhipster-azure-container-apps"><b>generator-jhipster-azure-container-apps</b></a> will be added.<br>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,28 @@ export class AzureGeneratorComponent implements OnInit {
hideApplicationType: true,
hideServiceDiscoveryType: true,
hideAuthenticationType: true,
hideDatabaseType: true,
hideProdDatabaseTypeOptions: ['mysql', 'mariadb', 'oracle', 'mssql', 'mongodb', 'cassandra', 'couchbase', 'neo4j', 'no'],
hideDevDatabaseTypeOptions: [
'h2Disk',
'h2Memory',
'mysql',
'mariadb',
'oracle',
'mssql',
'mongodb',
'cassandra',
'couchbase',
'neo4j',
'no'
],
hideHibernateCache: true,
hideDevDatabaseType: true,
hideDatabaseTypeOptions: ['cassandra', 'couchbase', 'neo4j', 'no'],
hideProdDatabaseTypeOptions: ['mysql', 'mariadb', 'oracle', 'mssql', 'cassandra', 'couchbase', 'neo4j', 'no'],
hideDevDatabaseTypeOptions: ['h2Disk', 'h2Memory', 'mysql', 'mariadb', 'oracle', 'mssql', 'cassandra', 'couchbase', 'neo4j', 'no'],
hideCacheProvider: true,
hideBuildTool: true,
hideOtherComponents: true,
hideClientSideOptions: true,
hideI18nOptions: true,
hideTestingOptions: true
hideTestingOptions: true,
disableNoDatabaseOptions: true
};
azureJHipsterModel: JHipsterConfigurationModel = new JHipsterConfigurationModel();

ngOnInit(): void {
this.azureJHipsterModel.devDatabaseType = 'postgresql';
this.azureJHipsterModel.databaseType = 'sql';
this.azureJHipsterModel.prodDatabaseType = 'postgresql';
this.azureJHipsterModel.cacheProvider = 'no';
this.azureJHipsterModel.clientFramework = 'react';
// Repository for this blueprint is
// https://github.com/Azure/generator-jhipster-azure-spring-apps
this.azureJHipsterModel.blueprints.push({ name: 'generator-jhipster-azure-spring-apps' });
// https://github.com/Azure/generator-jhipster-azure-container-apps
this.azureJHipsterModel.blueprints.push({ name: 'generator-jhipster-azure-container-apps' });
}
}
18 changes: 9 additions & 9 deletions src/main/webapp/app/home/generator/generator.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ <h4>Server side options</h4>
<label for="databaseType">Which <i>type</i> of database would you like to use?</label>
<select id="databaseType" [(ngModel)]="model.databaseType" name="databaseType" class="form-control"
#databaseType="ngModel" (change)="changeDatabaseType()">
<option value="sql">SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)</option>
<option value="mongodb">MongoDB</option>
<option value="cassandra" *ngIf="model.authenticationType !== 'oauth2'">Cassandra</option>
<option value="couchbase">Couchbase</option>
<option value="neo4j">Neo4j</option>
<option value="no">No database</option>
<option value="sql" *ngIf="!isDatabaseTypeOptionHidden('sql')">SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)</option>
<option value="mongodb" *ngIf="!isDatabaseTypeOptionHidden('mongodb')">MongoDB</option>
<option value="cassandra" *ngIf="model.authenticationType !== 'oauth2' && !isDatabaseTypeOptionHidden('cassandra')">Cassandra</option>
<option value="couchbase" *ngIf="!isDatabaseTypeOptionHidden('couchbase')">Couchbase</option>
<option value="neo4j" *ngIf="!isDatabaseTypeOptionHidden('neo4j')">Neo4j</option>
<option value="no" *ngIf="!isDatabaseTypeOptionHidden('no')">No database</option>
</select>
</div>
<div class="form-group" *ngIf="!config.hideProdDatabaseType">
Expand All @@ -114,7 +114,7 @@ <h4>Server side options</h4>
<option value="cassandra" *ngIf="!isProdDatabaseOptionHidden('cassandra', 'cassandra')">Cassandra</option>
<option value="couchbase" *ngIf="!isProdDatabaseOptionHidden('couchbase', 'couchbase')">Couchbase</option>
<option value="neo4j" *ngIf="!isProdDatabaseOptionHidden('neo4j', 'neo4j')">Neo4j</option>
<option value="no" *ngIf="!isProdDatabaseOptionHidden('no', 'no') || !config.hideDatabaseType">No database</option>
<option value="no" [hidden]="config.disableNoDatabaseOptions == true" *ngIf="!isProdDatabaseOptionHidden('no', 'no') || !config.hideDatabaseType">No database</option>
</select>
</div>
<div class="form-group" *ngIf="!config.hideDevDatabaseType">
Expand All @@ -134,7 +134,7 @@ <h4>Server side options</h4>
<option value="cassandra" *ngIf="!isDevDatabaseOptionHidden('cassandra', 'cassandra')">Cassandra</option>
<option value="couchbase" *ngIf="!isDevDatabaseOptionHidden('couchbase', 'couchbase')">Couchbase</option>
<option value="neo4j" *ngIf="!isDevDatabaseOptionHidden('neo4j', 'neo4j')">Neo4j</option>
<option value="no" *ngIf="!isDevDatabaseOptionHidden('no', 'no') || !config.hideDatabaseType">No database</option>
<option value="no" [hidden]="config.disableNoDatabaseOptions == false" *ngIf="!isDevDatabaseOptionHidden('no', 'no') || !config.hideDatabaseType">No database</option>
</select>
</div>
<div class="form-group" *ngIf="!config.hideCacheProvider">
Expand All @@ -150,7 +150,7 @@ <h4>Server side options</h4>
<option value="no">No</option>
</select>
</div>
<div class="form-group" [hidden]="model.databaseType !== 'sql' || model.cacheProvider === 'no'">
<div class="form-group" [hidden]="model.databaseType !== 'sql' || model.cacheProvider === 'no'" *ngIf="!config.hideHibernateCache">
<label for="enableHibernateCache">Do you want to use Hibernate 2nd level cache?</label>
<select id="enableHibernateCache" [(ngModel)]="model.enableHibernateCache" name="enableHibernateCache"
class="form-control" #enableHibernateCache="ngModel">
Expand Down
5 changes: 5 additions & 0 deletions src/main/webapp/app/home/generator/generator.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { GeneratorOutputDialogComponent } from './generator.output.component';
import {
AllDevDatabaseTypes,
AllProdDatabaseTypes,
DatabaseType,
DevDatabaseType,
GeneratorConfigurationModel,
ProdDatabaseType
Expand Down Expand Up @@ -334,6 +335,10 @@ export class GeneratorComponent implements OnInit {
return this.model.databaseType !== validDatabaseType || Boolean(this.config?.hideProdDatabaseTypeOptions?.includes(databaseName));
}

isDatabaseTypeOptionHidden(databaseType: DatabaseType): boolean {
return Boolean(this.config?.hideDatabaseTypeOptions?.includes(databaseType));
}

isDevDatabaseOptionHidden(validDatabaseType: string, databaseName: DevDatabaseType): boolean {
return (
this.model.databaseType !== validDatabaseType ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export type ProdDatabaseType =
| 'no';
export type DevDatabaseType = 'h2Disk' | 'h2Memory' | ProdDatabaseType;

export type DatabaseType = 'sql' | 'mongodb' | 'cassandra' | 'couchbase' | 'neo4j' | 'no';

export interface GeneratorConfigurationModel {
hideRepositoryName?: boolean;
hideApplicationType?: boolean;
Expand All @@ -52,6 +54,7 @@ export interface GeneratorConfigurationModel {
hideDatabaseType?: boolean;
hideProdDatabaseType?: boolean;
hideProdDatabaseTypeOptions?: ProdDatabaseType[];
hideDatabaseTypeOptions?: DatabaseType[];
hideDevDatabaseType?: boolean;
hideDevDatabaseTypeOptions?: DevDatabaseType[];
hideCacheProvider?: boolean;
Expand All @@ -60,4 +63,6 @@ export interface GeneratorConfigurationModel {
hideClientSideOptions?: boolean;
hideI18nOptions?: boolean;
hideTestingOptions?: boolean;
hideHibernateCache?: boolean;
disableNoDatabaseOptions?: boolean;
}

0 comments on commit 8d6ba62

Please sign in to comment.