Skip to content

Commit

Permalink
Refactor Generator component with SpringBootGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
Franceq34 authored and Quentin France committed Apr 26, 2022
1 parent a9fd663 commit 4adb384
Show file tree
Hide file tree
Showing 8 changed files with 827 additions and 926 deletions.
114 changes: 2 additions & 112 deletions src/main/webapp/app/springboot/primary/Generator.component.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { ProjectService } from '@/springboot/domain/ProjectService';
import { defineComponent, inject, ref } from 'vue';
import { ProjectToUpdate, toProject } from '@/springboot/primary/ProjectToUpdate';
import { SpringBootService } from '@/springboot/domain/SpringBootService';
import { Logger } from '@/common/domain/Logger';
import { AngularGeneratorVue } from '@/springboot/primary/angular-generator';
import { ReactGeneratorVue } from '@/springboot/primary/react-generator';
import { VueGeneratorVue } from '@/springboot/primary/vue-generator';
import { SvelteGeneratorVue } from '@/springboot/primary/svelte-generator';
import { SpringBootGeneratorVue } from '@/springboot/primary/spring-boot-generator';

export default defineComponent({
name: 'GeneratorComponent',
components: {
SpringBootGeneratorVue,
AngularGeneratorVue,
ReactGeneratorVue,
SvelteGeneratorVue,
Expand All @@ -19,7 +20,6 @@ export default defineComponent({
setup() {
const logger = inject('logger') as Logger;
const projectService = inject('projectService') as ProjectService;
const springBootService = inject('springBootService') as SpringBootService;

const selectorPrefix = 'generator';

Expand Down Expand Up @@ -73,102 +73,6 @@ export default defineComponent({
}
};

const addSpringBoot = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addSpringBoot(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot to project failed', error));
}
};

const addSpringBootMvcTomcat = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addSpringBootMvcTomcat(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot MVC with Tomcat to project failed', error));
}
};

const addSpringBootWebfluxNetty = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addSpringBootWebfluxNetty(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot Webflux with Netty to project failed', error));
}
};

const addSpringBootActuator = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addSpringBootActuator(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot Actuator to project failed', error));
}
};

const addSpringBootAopLogging = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addSpringBootAopLogging(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot AOP Logging to project failed', error));
}
};

const addSpringBootLogstash = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addSpringBootLogstash(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot Logstash to project failed', error));
}
};

const addSpringBootSecurityJWT = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addJWT(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot Security JWT to project failed', error));
}
};

const addSpringBootSecurityJWTBasicAuth = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addBasicAuthJWT(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot Security JWT Basic Auth to project failed', error));
}
};

const addPostgreSQL = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addPostgres(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot Database PostgreSQL to project failed', error));
}
};

const addMySQL = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addMySQL(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot Database MySQL to project failed', error));
}
};

const addMariaDB = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addMariaDB(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot Database MariaDB to project failed', error));
}
};

const addMongoDB = async (): Promise<void> => {
if (project.value.folder !== '') {
await springBootService
.addMongoDB(toProject(project.value))
.catch(error => logger.error('Adding SpringBoot Database MongoDB to project failed', error));
}
};

const addFrontendMavenPlugin = async (): Promise<void> => {
if (project.value.folder !== '') {
await projectService
Expand Down Expand Up @@ -204,20 +108,6 @@ export default defineComponent({
addSonarBackend,
addSonarBackendFrontend,
addJavaBase,
addSpringBoot,
addSpringBootMvcTomcat,
addSpringBootWebfluxNetty,
addSpringBootActuator,

addSpringBootAopLogging,
addSpringBootLogstash,

addSpringBootSecurityJWT,
addSpringBootSecurityJWTBasicAuth,
addPostgreSQL,
addMySQL,
addMariaDB,
addMongoDB,
addFrontendMavenPlugin,
download,
selectorPrefix,
Expand Down
119 changes: 1 addition & 118 deletions src/main/webapp/app/springboot/primary/Generator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -558,124 +558,7 @@
Download
</button>
</div>
<div
v-if="server === 'springboot'"
id="v-pills-springboot"
class="tab-pane fade"
role="tabpanel"
aria-labelledby="v-pills-profile-tab"
>
<button
id="springboot"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-button'"
@click.prevent="addSpringBoot"
>
Spring Boot
</button>

<button
id="springbootmvctomcat"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-mvc-tomcat-button'"
@click.prevent="addSpringBootMvcTomcat"
>
Spring MVC Tomcat
</button>

<button
id="springbootwebfluxnetty"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-webflux-netty-button'"
@click.prevent="addSpringBootWebfluxNetty"
>
Spring Webflux Netty
</button>

<button
id="springboot-actuator"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-actuator-button'"
@click.prevent="addSpringBootActuator"
>
Spring Boot Actuator
</button>
<br />
<br />
<button
id="springboot-aop"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-aop-button'"
@click.prevent="addSpringBootAopLogging"
>
AOP Logging
</button>

<button
id="springboot-logstash"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-logstash-button'"
@click.prevent="addSpringBootLogstash"
>
Logstash
</button>
<br />
<br />
<button
id="springboot-jwt"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-jwt-button'"
@click.prevent="addSpringBootSecurityJWT"
>
Security JWT
</button>

<button
id="springboot-jwt-basic-auth"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-jwt-basic-auth-button'"
@click.prevent="addSpringBootSecurityJWTBasicAuth"
>
Security JWT Basic Auth
</button>
<br />
<br />
<button
id="springboot-database-postgresql"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-database-postgresql-button'"
@click.prevent="addPostgreSQL"
>
PostgreSQL
</button>

<button
id="springboot-database-mysql"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-database-mysql-button'"
@click.prevent="addMySQL"
>
MySQL
</button>

<button
id="springboot-database-mariadb"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-database-mariadb-button'"
@click.prevent="addMariaDB"
>
MariaDB
</button>

<button
id="springboot-database-mongodb"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-spring-boot-database-mongodb-button'"
@click.prevent="addMongoDB"
>
MongoDB
</button>
</div>
<SpringBootGeneratorVue v-if="server === 'springboot'" :project="project" />
<AngularGeneratorVue v-if="client === 'angular'" :project="project" />
<ReactGeneratorVue v-if="client === 'react'" :project="project" />
<VueGeneratorVue v-if="client === 'vue'" :project="project" />
Expand Down
Loading

0 comments on commit 4adb384

Please sign in to comment.