From ae48a7bc4004cf2334fc868febea1d89b1893e8b Mon Sep 17 00:00:00 2001 From: Quentin France Date: Mon, 25 Apr 2022 15:50:59 +0200 Subject: [PATCH] Refactor Generator component with AngularGenerator --- .../springboot/primary/Generator.component.ts | 22 +--- .../app/springboot/primary/Generator.vue | 31 +---- .../AngularGenerator.component.ts | 44 +++++++ .../angular-generator/AngularGenerator.vue | 28 ++++ .../primary/angular-generator/index.ts | 4 + .../cypress/integration/Generator.spec.ts | 3 +- .../spec/springboot/primary/Generator.spec.ts | 113 +--------------- .../AngularGenerator.spec.ts | 121 ++++++++++++++++++ 8 files changed, 207 insertions(+), 159 deletions(-) create mode 100644 src/main/webapp/app/springboot/primary/angular-generator/AngularGenerator.component.ts create mode 100644 src/main/webapp/app/springboot/primary/angular-generator/AngularGenerator.vue create mode 100644 src/main/webapp/app/springboot/primary/angular-generator/index.ts create mode 100644 src/test/javascript/spec/springboot/primary/angular-generator/AngularGenerator.spec.ts diff --git a/src/main/webapp/app/springboot/primary/Generator.component.ts b/src/main/webapp/app/springboot/primary/Generator.component.ts index 0c6a5efa9f6..7c7f45e31b9 100644 --- a/src/main/webapp/app/springboot/primary/Generator.component.ts +++ b/src/main/webapp/app/springboot/primary/Generator.component.ts @@ -1,17 +1,18 @@ import { ProjectService } from '@/springboot/domain/ProjectService'; import { defineComponent, inject, ref } from 'vue'; import { ProjectToUpdate, toProject } from '@/springboot/primary/ProjectToUpdate'; -import { AngularService } from '@/springboot/domain/client/AngularService'; import { ReactService } from '@/springboot/domain/client/ReactService'; import { VueService } from '@/springboot/domain/client/VueService'; import { SpringBootService } from '@/springboot/domain/SpringBootService'; import { Logger } from '@/common/domain/Logger'; +import { AngularGeneratorVue } from '@/springboot/primary/angular-generator'; export default defineComponent({ name: 'GeneratorComponent', - components: {}, + components: { + AngularGeneratorVue, + }, setup() { - const angularService = inject('angularService') as AngularService; const logger = inject('logger') as Logger; const projectService = inject('projectService') as ProjectService; const reactService = inject('reactService') as ReactService; @@ -23,7 +24,6 @@ export default defineComponent({ const project = ref({ folder: '', }); - const isAngularWithStyle = ref(false); const isReactWithStyle = ref(false); const isVueWithStyle = ref(false); const isSvelteWithStyle = ref(false); @@ -170,18 +170,6 @@ export default defineComponent({ } }; - const addAngular = async (): Promise => { - if (project.value.folder !== '') { - if (isAngularWithStyle.value) { - await angularService - .addWithStyle(toProject(project.value)) - .catch(error => logger.error('Adding Angular with style to project failed', error)); - } else { - await angularService.add(toProject(project.value)).catch(error => logger.error('Adding Angular to project failed', error)); - } - } - }; - const addReact = async (): Promise => { if (project.value.folder !== '') { if (isReactWithStyle.value) { @@ -231,7 +219,6 @@ export default defineComponent({ return { project, - isAngularWithStyle, isReactWithStyle, isVueWithStyle, isSvelteWithStyle, @@ -259,7 +246,6 @@ export default defineComponent({ addMySQL, addMariaDB, addMongoDB, - addAngular, addReact, addVue, addFrontendMavenPlugin, diff --git a/src/main/webapp/app/springboot/primary/Generator.vue b/src/main/webapp/app/springboot/primary/Generator.vue index 9ce0801fc3a..16ca6540bd7 100644 --- a/src/main/webapp/app/springboot/primary/Generator.vue +++ b/src/main/webapp/app/springboot/primary/Generator.vue @@ -676,36 +676,7 @@ MongoDB -
-
- -
- -
+