-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/main/webapp/app/springboot/primary/generator/ServiceProjection.ts b/src/main/webapp/app/springboot/primary/generator/ServiceProjection.ts
new file mode 100644
index 00000000000..f25f38e81b3
--- /dev/null
+++ b/src/main/webapp/app/springboot/primary/generator/ServiceProjection.ts
@@ -0,0 +1,148 @@
+import { Service } from '@/common/domain/Service';
+
+export type ServiceProjection =
+ | 'aop-logging'
+ | 'angular'
+ | 'download'
+ | 'initialization'
+ | 'frontend-maven-plugin'
+ | 'jacoco-check-minimal-coverage'
+ | 'java-base'
+ | 'logstash'
+ | 'maven-java'
+ | 'mariadb'
+ | 'mysql'
+ | 'mongodb'
+ | 'mongock'
+ | 'postgresql'
+ | 'sonar-java-backend'
+ | 'sonar-java-backend-and-frontend'
+ | 'spring-boot'
+ | 'spring-boot-actuator'
+ | 'spring-boot-jwt'
+ | 'spring-boot-jwt-with-basic-authentication'
+ | 'spring-boot-mvc-with-tomcat'
+ | 'spring-boot-webflux-netty'
+ | 'react'
+ | 'react-styled'
+ | 'vue'
+ | 'vue-styled'
+ | 'unknown';
+
+export const toServiceProjection = (service: Service): ServiceProjection => {
+ switch (service) {
+ case Service.AOP_LOGGING:
+ return 'aop-logging';
+ case Service.ANGULAR:
+ return 'angular';
+ case Service.DOWNLOAD:
+ return 'download';
+ case Service.INITIALIZATION:
+ return 'initialization';
+ case Service.FRONTEND_MAVEN_PLUGIN:
+ return 'frontend-maven-plugin';
+ case Service.JACOCO_CHECK_MINIMAL_COVERAGE:
+ return 'jacoco-check-minimal-coverage';
+ case Service.JAVA_BASE:
+ return 'java-base';
+ case Service.LOGSTASH:
+ return 'logstash';
+ case Service.MAVEN_JAVA:
+ return 'maven-java';
+ case Service.MARIADB:
+ return 'mariadb';
+ case Service.MYSQL:
+ return 'mysql';
+ case Service.MONGODB:
+ return 'mongodb';
+ case Service.MONGOCK:
+ return 'mongock';
+ case Service.POSTGRESQL:
+ return 'postgresql';
+ case Service.SONAR_JAVA_BACKEND:
+ return 'sonar-java-backend';
+ case Service.SONAR_JAVA_BACKEND_AND_FRONTEND:
+ return 'sonar-java-backend-and-frontend';
+ case Service.SPRINGBOOT:
+ return 'spring-boot';
+ case Service.SPRINGBOOT_ACTUATOR:
+ return 'spring-boot-actuator';
+ case Service.SPRINGBOOT_JWT:
+ return 'spring-boot-jwt';
+ case Service.SPRINGBOOT_JWT_WITH_BASIC_AUTHENTICATION:
+ return 'spring-boot-jwt-with-basic-authentication';
+ case Service.SPRINGBOOT_MVC_WITH_TOMCAT:
+ return 'spring-boot-mvc-with-tomcat';
+ case Service.SPRINGBOOT_WEBFLUX_NETTY:
+ return 'spring-boot-webflux-netty';
+ case Service.REACT:
+ return 'react';
+ case Service.REACT_STYLED:
+ return 'react-styled';
+ case Service.VUE:
+ return 'vue';
+ case Service.VUE_STYLED:
+ return 'vue-styled';
+ case Service.UNKNOWN:
+ return 'unknown';
+ }
+};
+
+export const fromServiceProjection = (serviceProjection: ServiceProjection): Service => {
+ switch (serviceProjection) {
+ case 'aop-logging':
+ return Service.AOP_LOGGING;
+ case 'angular':
+ return Service.ANGULAR;
+ case 'download':
+ return Service.DOWNLOAD;
+ case 'initialization':
+ return Service.INITIALIZATION;
+ case 'frontend-maven-plugin':
+ return Service.FRONTEND_MAVEN_PLUGIN;
+ case 'jacoco-check-minimal-coverage':
+ return Service.JACOCO_CHECK_MINIMAL_COVERAGE;
+ case 'java-base':
+ return Service.JAVA_BASE;
+ case 'logstash':
+ return Service.LOGSTASH;
+ case 'maven-java':
+ return Service.MAVEN_JAVA;
+ case 'mariadb':
+ return Service.MARIADB;
+ case 'mysql':
+ return Service.MYSQL;
+ case 'mongodb':
+ return Service.MONGODB;
+ case 'mongock':
+ return Service.MONGOCK;
+ case 'postgresql':
+ return Service.POSTGRESQL;
+ case 'sonar-java-backend':
+ return Service.SONAR_JAVA_BACKEND;
+ case 'sonar-java-backend-and-frontend':
+ return Service.SONAR_JAVA_BACKEND_AND_FRONTEND;
+ case 'spring-boot':
+ return Service.SPRINGBOOT;
+ case 'spring-boot-actuator':
+ return Service.SPRINGBOOT_ACTUATOR;
+ case 'spring-boot-jwt':
+ return Service.SPRINGBOOT_JWT;
+ case 'spring-boot-jwt-with-basic-authentication':
+ return Service.SPRINGBOOT_JWT_WITH_BASIC_AUTHENTICATION;
+ case 'spring-boot-mvc-with-tomcat':
+ return Service.SPRINGBOOT_MVC_WITH_TOMCAT;
+ case 'spring-boot-webflux-netty':
+ return Service.SPRINGBOOT_WEBFLUX_NETTY;
+ case 'react':
+ return Service.REACT;
+ case 'react-styled':
+ return Service.REACT_STYLED;
+ case 'vue':
+ return Service.VUE;
+ case 'vue-styled':
+ return Service.VUE_STYLED;
+ case 'unknown':
+ return Service.UNKNOWN;
+ }
+};
diff --git a/src/main/webapp/app/springboot/primary/angular-generator/AngularGenerator.component.ts b/src/main/webapp/app/springboot/primary/generator/angular-generator/AngularGenerator.component.ts
similarity index 89%
rename from src/main/webapp/app/springboot/primary/angular-generator/AngularGenerator.component.ts
rename to src/main/webapp/app/springboot/primary/generator/angular-generator/AngularGenerator.component.ts
index e81f8da3244..853bd52f79b 100644
--- a/src/main/webapp/app/springboot/primary/angular-generator/AngularGenerator.component.ts
+++ b/src/main/webapp/app/springboot/primary/generator/angular-generator/AngularGenerator.component.ts
@@ -2,13 +2,13 @@ import { defineComponent, inject } from 'vue';
import { AngularService } from '@/springboot/domain/client/AngularService';
import { ProjectToUpdate, toProject } from '@/springboot/primary/ProjectToUpdate';
import { Logger } from '@/common/domain/Logger';
-import { DefaultButtonVue } from '@/common/primary/default-button';
+import { GeneratorButtonVue } from '@/springboot/primary/generator/generator-button';
export default defineComponent({
name: 'AngularGeneratorComponent',
components: {
- DefaultButtonVue,
+ GeneratorButtonVue,
},
props: {
diff --git a/src/main/webapp/app/springboot/primary/angular-generator/AngularGenerator.vue b/src/main/webapp/app/springboot/primary/generator/angular-generator/AngularGenerator.vue
similarity index 53%
rename from src/main/webapp/app/springboot/primary/angular-generator/AngularGenerator.vue
rename to src/main/webapp/app/springboot/primary/generator/angular-generator/AngularGenerator.vue
index 7e1300d49b7..16f24d7ccb8 100644
--- a/src/main/webapp/app/springboot/primary/angular-generator/AngularGenerator.vue
+++ b/src/main/webapp/app/springboot/primary/generator/angular-generator/AngularGenerator.vue
@@ -1,11 +1,6 @@
-
+
diff --git a/src/main/webapp/app/springboot/primary/angular-generator/index.ts b/src/main/webapp/app/springboot/primary/generator/angular-generator/index.ts
similarity index 100%
rename from src/main/webapp/app/springboot/primary/angular-generator/index.ts
rename to src/main/webapp/app/springboot/primary/generator/angular-generator/index.ts
diff --git a/src/main/webapp/app/springboot/primary/generator/generator-button/GeneratorButton.component.ts b/src/main/webapp/app/springboot/primary/generator/generator-button/GeneratorButton.component.ts
new file mode 100644
index 00000000000..4b5b910ca43
--- /dev/null
+++ b/src/main/webapp/app/springboot/primary/generator/generator-button/GeneratorButton.component.ts
@@ -0,0 +1,37 @@
+import { computed, defineComponent, inject } from 'vue';
+import { DefaultButtonVue } from '@/common/primary/default-button';
+import { StoreGeneric } from 'pinia';
+import { fromServiceProjection, ServiceProjection } from '@/springboot/primary/generator/ServiceProjection';
+
+export default defineComponent({
+ name: 'GeneratorButtonComponent',
+
+ components: {
+ DefaultButtonVue,
+ },
+
+ props: {
+ label: {
+ type: String,
+ required: true,
+ },
+ service: {
+ type: String,
+ required: true,
+ },
+ selectorPrefix: {
+ type: String,
+ required: true,
+ },
+ },
+
+ setup(props) {
+ const historyStore = inject('historyStore') as StoreGeneric;
+
+ const hasCalledService = computed(() => historyStore.hasCalledService(fromServiceProjection(props.service as ServiceProjection)));
+
+ return {
+ hasCalledService,
+ };
+ },
+});
diff --git a/src/main/webapp/app/springboot/primary/generator/generator-button/GeneratorButton.vue b/src/main/webapp/app/springboot/primary/generator/generator-button/GeneratorButton.vue
new file mode 100644
index 00000000000..f8489581cdd
--- /dev/null
+++ b/src/main/webapp/app/springboot/primary/generator/generator-button/GeneratorButton.vue
@@ -0,0 +1,11 @@
+
+
+
+
+
diff --git a/src/main/webapp/app/springboot/primary/generator/generator-button/index.ts b/src/main/webapp/app/springboot/primary/generator/generator-button/index.ts
new file mode 100644
index 00000000000..d3ea36752d5
--- /dev/null
+++ b/src/main/webapp/app/springboot/primary/generator/generator-button/index.ts
@@ -0,0 +1,4 @@
+import GeneratorButtonComponent from './GeneratorButton.component';
+import GeneratorButtonVue from './GeneratorButton.vue';
+
+export { GeneratorButtonComponent, GeneratorButtonVue };
diff --git a/src/main/webapp/app/springboot/primary/generator/project-generator/ProjectGenerator.component.ts b/src/main/webapp/app/springboot/primary/generator/project-generator/ProjectGenerator.component.ts
new file mode 100644
index 00000000000..0b19f9a670b
--- /dev/null
+++ b/src/main/webapp/app/springboot/primary/generator/project-generator/ProjectGenerator.component.ts
@@ -0,0 +1,111 @@
+import { defineComponent, inject } from 'vue';
+import { ProjectToUpdate, toProject } from '@/springboot/primary/ProjectToUpdate';
+import { Logger } from '@/common/domain/Logger';
+import { ProjectService } from '@/springboot/domain/ProjectService';
+import { FileDownloader } from '@/common/primary/FileDownloader';
+import { GeneratorButtonVue } from '@/springboot/primary/generator/generator-button';
+
+export default defineComponent({
+ name: 'ProjectGeneratorComponent',
+
+ components: {
+ GeneratorButtonVue,
+ },
+
+ props: {
+ project: {
+ type: Object,
+ required: true,
+ },
+ buildTool: {
+ type: String,
+ required: true,
+ },
+ },
+
+ setup(props) {
+ const logger = inject('logger') as Logger;
+ const projectService = inject('projectService') as ProjectService;
+ const fileDownloader = inject('fileDownloader') as FileDownloader;
+
+ const selectorPrefix = 'project-generator';
+
+ const initProject = async (): Promise
=> {
+ if (props.project.folder !== '') {
+ await projectService
+ .init(toProject(props.project as ProjectToUpdate))
+ .catch(error => logger.error('Project initialization failed', error.message));
+ }
+ };
+
+ const addMaven = async (): Promise => {
+ if (props.project.folder !== '') {
+ await projectService
+ .addMaven(toProject(props.project as ProjectToUpdate))
+ .catch(error => logger.error('Adding Maven to project failed', error));
+ }
+ };
+
+ const addJaCoCo = async (): Promise => {
+ if (props.project.folder !== '') {
+ await projectService
+ .addJaCoCo(toProject(props.project as ProjectToUpdate))
+ .catch(error => logger.error('Adding JaCoCo to project failed', error));
+ }
+ };
+
+ const addSonarBackend = async (): Promise => {
+ if (props.project.folder !== '') {
+ await projectService
+ .addSonarBackend(toProject(props.project as ProjectToUpdate))
+ .catch(error => logger.error('Adding Sonar Backend to project failed', error));
+ }
+ };
+
+ const addSonarBackendFrontend = async (): Promise => {
+ if (props.project.folder !== '') {
+ await projectService
+ .addSonarBackendFrontend(toProject(props.project as ProjectToUpdate))
+ .catch(error => logger.error('Adding Sonar Backend+Frontend to project failed', error));
+ }
+ };
+
+ const addJavaBase = async (): Promise => {
+ if (props.project.folder !== '') {
+ await projectService
+ .addJavaBase(toProject(props.project as ProjectToUpdate))
+ .catch(error => logger.error('Adding Java Base to project failed', error));
+ }
+ };
+
+ const addFrontendMavenPlugin = async (): Promise => {
+ if (props.project.folder !== '') {
+ await projectService
+ .addFrontendMavenPlugin(toProject(props.project as ProjectToUpdate))
+ .catch(error => logger.error('Adding Frontend Maven Plugin to project failed', error));
+ }
+ };
+
+ const download = async (): Promise => {
+ await projectService
+ .download(toProject(props.project as ProjectToUpdate))
+ .then(file => {
+ fileDownloader.download(file);
+ })
+ .catch(error => logger.error('Downloading project failed', error));
+ };
+
+ return {
+ selectorPrefix,
+ props,
+ initProject,
+ addMaven,
+ addJaCoCo,
+ addSonarBackend,
+ addSonarBackendFrontend,
+ addJavaBase,
+ addFrontendMavenPlugin,
+ download,
+ };
+ },
+});
diff --git a/src/main/webapp/app/springboot/primary/generator/project-generator/ProjectGenerator.vue b/src/main/webapp/app/springboot/primary/generator/project-generator/ProjectGenerator.vue
new file mode 100644
index 00000000000..3589763cf59
--- /dev/null
+++ b/src/main/webapp/app/springboot/primary/generator/project-generator/ProjectGenerator.vue
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/webapp/app/springboot/primary/generator/project-generator/index.ts b/src/main/webapp/app/springboot/primary/generator/project-generator/index.ts
new file mode 100644
index 00000000000..450dadb7a31
--- /dev/null
+++ b/src/main/webapp/app/springboot/primary/generator/project-generator/index.ts
@@ -0,0 +1,4 @@
+import ProjectGeneratorComponent from './ProjectGenerator.component';
+import ProjectGeneratorVue from './ProjectGenerator.vue';
+
+export { ProjectGeneratorComponent, ProjectGeneratorVue };
diff --git a/src/main/webapp/app/springboot/primary/react-generator/ReactGenerator.component.ts b/src/main/webapp/app/springboot/primary/generator/react-generator/ReactGenerator.component.ts
similarity index 92%
rename from src/main/webapp/app/springboot/primary/react-generator/ReactGenerator.component.ts
rename to src/main/webapp/app/springboot/primary/generator/react-generator/ReactGenerator.component.ts
index 0f96f372e8b..797fac79d99 100644
--- a/src/main/webapp/app/springboot/primary/react-generator/ReactGenerator.component.ts
+++ b/src/main/webapp/app/springboot/primary/generator/react-generator/ReactGenerator.component.ts
@@ -2,13 +2,13 @@ import { defineComponent, inject, ref } from 'vue';
import { ProjectToUpdate, toProject } from '@/springboot/primary/ProjectToUpdate';
import { Logger } from '@/common/domain/Logger';
import { ReactService } from '@/springboot/domain/client/ReactService';
-import { DefaultButtonVue } from '@/common/primary/default-button';
+import { GeneratorButtonVue } from '@/springboot/primary/generator/generator-button';
export default defineComponent({
name: 'ReactGeneratorComponent',
components: {
- DefaultButtonVue,
+ GeneratorButtonVue,
},
props: {
diff --git a/src/main/webapp/app/springboot/primary/react-generator/ReactGenerator.vue b/src/main/webapp/app/springboot/primary/generator/react-generator/ReactGenerator.vue
similarity index 85%
rename from src/main/webapp/app/springboot/primary/react-generator/ReactGenerator.vue
rename to src/main/webapp/app/springboot/primary/generator/react-generator/ReactGenerator.vue
index e017f1936d6..f33162ce734 100644
--- a/src/main/webapp/app/springboot/primary/react-generator/ReactGenerator.vue
+++ b/src/main/webapp/app/springboot/primary/generator/react-generator/ReactGenerator.vue
@@ -15,10 +15,10 @@