Skip to content

Commit

Permalink
Merge pull request #1522 from Franceq34/mutualize-buttons
Browse files Browse the repository at this point in the history
Mutualize buttons
  • Loading branch information
pascalgrimaud authored Apr 27, 2022
2 parents dcccebf + 754fb46 commit 9a02dc2
Show file tree
Hide file tree
Showing 16 changed files with 239 additions and 199 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineComponent } from 'vue';

export default defineComponent({
name: 'DefaultButton',

props: {
label: {
type: String,
required: true,
},
disabled: {
type: Boolean,
default: false,
},
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<button class="btn btn-outline-primary" :disabled="disabled">
{{ label }}
</button>
</template>

<script lang="ts" src="./DefaultButton.component.ts"></script>
4 changes: 4 additions & 0 deletions src/main/webapp/app/common/primary/default-button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import DefaultButtonComponent from './DefaultButton.component';
import DefaultButtonVue from './DefaultButton.vue';

export { DefaultButtonComponent, DefaultButtonVue };
2 changes: 2 additions & 0 deletions src/main/webapp/app/springboot/primary/Generator.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import { VueGeneratorVue } from '@/springboot/primary/vue-generator';
import { SvelteGeneratorVue } from '@/springboot/primary/svelte-generator';
import { SpringBootGeneratorVue } from '@/springboot/primary/spring-boot-generator';
import { FileDownloader } from '@/common/primary/FileDownloader';
import { DefaultButtonVue } from '@/common/primary/default-button';

export default defineComponent({
name: 'GeneratorComponent',
components: {
DefaultButtonVue,
SpringBootGeneratorVue,
AngularGeneratorVue,
ReactGeneratorVue,
Expand Down
134 changes: 59 additions & 75 deletions src/main/webapp/app/springboot/primary/Generator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
</div>
</div>
</div>
<div class="row my-4 d-flex align-items-start shadow">
<div class="row mt-4 d-flex align-items-start shadow">
<div class="col-12 col-md-4 col-lg-4 px-0">
<ul id="v-pills-tab" class="nav nav-pills flex-column nav-fill" role="tablist" aria-orientation="vertical">
<li class="nav-item">
Expand Down Expand Up @@ -411,8 +411,7 @@
/>
<path
fill="#FFFFFF"
d="M125,52.1L66.8,182.6h0h21.7h0l11.7-29.2h49.4l11.7,29.2h0h21.7h0L125,52.1L125,52.1L125,52.1L125,52.1
L125,52.1z M142,135.4H108l17-40.9L142,135.4z"
d="M125,52.1L66.8,182.6h0h21.7h0l11.7-29.2h49.4l11.7,29.2h0h21.7h0L125,52.1L125,52.1L125,52.1L125,52.1L125,52.1z M142,135.4H108l17-40.9L142,135.4z"
/>
</g>
</svg>
Expand Down Expand Up @@ -485,78 +484,63 @@
<div class="col py-2">
<div id="v-pills-tab" class="tab-content">
<div id="v-pills-init" class="tab-pane fade show active" role="tabpanel" aria-labelledby="v-pills-home-tab">
<button id="init" class="btn btn-outline-primary" :data-selector="selectorPrefix + '.init-button'" @click.prevent="initProject">
Init
</button>
<br />
<br />
<button
v-if="buildTool === 'maven'"
id="maven"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-maven-button'"
@click.prevent="addMaven"
>
Maven
</button>

<button
id="jacoco"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-jacoco-button'"
@click.prevent="addJaCoCo"
>
JaCoCo
</button>

<button
id="sonar-backend"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-sonar-backend-button'"
@click.prevent="addSonarBackend"
>
Sonar Backend
</button>

<button
id="sonar-backend-frontend"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-sonar-backend-frontend-button'"
@click.prevent="addSonarBackendFrontend"
>
Sonar Backend+Frontend
</button>
<br />
<br />
<button
id="javabase"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-java-base-button'"
@click.prevent="addJavaBase"
>
Java Base
</button>
<br />
<br />
<button
id="frontend-maven-plugin"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.add-frontend-maven-plugin-button'"
@click.prevent="addFrontendMavenPlugin"
>
Frontend Maven Plugin
</button>
<br />
<br />
<button
v-if="project.folder !== ''"
id="download"
class="btn btn-outline-primary"
:data-selector="selectorPrefix + '.download-button'"
@click.prevent="download"
>
Download
</button>
<div class="d-flex flex-column gap-3">
<div>
<DefaultButtonVue id="init" :label="'Init'" :data-selector="selectorPrefix + '.init-button'" @click.prevent="initProject" />
</div>
<div>
<DefaultButtonVue
v-if="buildTool === 'maven'"
id="maven"
:label="'Maven'"
:data-selector="selectorPrefix + '.add-maven-button'"
@click.prevent="addMaven"
/>
<DefaultButtonVue
id="jacoco"
:label="'JaCoCo'"
:data-selector="selectorPrefix + '.add-jacoco-button'"
@click.prevent="addJaCoCo"
/>
<DefaultButtonVue
id="sonar-backend"
:label="'Sonar Backend'"
:data-selector="selectorPrefix + '.add-sonar-backend-button'"
@click.prevent="addSonarBackend"
/>
<DefaultButtonVue
id="sonar-backend-frontend"
:label="'Sonar Backend+Frontend'"
:data-selector="selectorPrefix + '.add-sonar-backend-frontend-button'"
@click.prevent="addSonarBackendFrontend"
/>
</div>
<div>
<DefaultButtonVue
id="javabase"
:label="'Java Base'"
:data-selector="selectorPrefix + '.add-java-base-button'"
@click.prevent="addJavaBase"
/>
</div>
<div>
<DefaultButtonVue
id="frontend-maven-plugin"
:label="'Frontend Maven Plugin'"
:data-selector="selectorPrefix + '.add-frontend-maven-plugin-button'"
@click.prevent="addFrontendMavenPlugin"
/>
</div>
<div>
<DefaultButtonVue
v-if="project.folder !== ''"
id="download"
:label="'Download'"
:data-selector="selectorPrefix + '.download-button'"
@click.prevent="download"
/>
</div>
</div>
</div>
<SpringBootGeneratorVue v-if="server === 'springboot'" :project="project" />
<AngularGeneratorVue v-if="client === 'angular'" :project="project" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ import { defineComponent, inject, ref } 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';

export default defineComponent({
name: 'AngularGeneratorComponent',

components: {
DefaultButtonVue,
},

props: {
project: {
type: Object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
</span>
</label>
</div>
<button
<DefaultButtonVue
id="angular"
class="btn btn-outline-primary"
:label="'Generate Angular'"
:data-selector="selectorPrefix + '.add-angular-button'"
@click.prevent="addAngular"
>
Generate Angular
</button>
/>
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ 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';

export default defineComponent({
name: 'ReactGeneratorComponent',

components: {
DefaultButtonVue,
},

props: {
project: {
type: Object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
</span>
</label>
</div>
<button id="react" class="btn btn-outline-primary" :data-selector="selectorPrefix + '.add-react-button'" @click.prevent="addReact">
Generate React
</button>
<DefaultButtonVue
id="react"
:label="'Generate React'"
:data-selector="selectorPrefix + '.add-react-button'"
@click.prevent="addReact"
/>
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ import { defineComponent, inject } from 'vue';
import { ProjectToUpdate, toProject } from '@/springboot/primary/ProjectToUpdate';
import { Logger } from '@/common/domain/Logger';
import { SpringBootService } from '@/springboot/domain/SpringBootService';
import { DefaultButtonVue } from '@/common/primary/default-button';

export default defineComponent({
name: 'SpringBootGeneratorComponent',

components: {
DefaultButtonVue,
},

props: {
project: {
type: Object,
Expand Down
Loading

0 comments on commit 9a02dc2

Please sign in to comment.