Skip to content

Commit

Permalink
Merge pull request #2149 from marioneyraud/front-setup-section
Browse files Browse the repository at this point in the history
Front: add setup section
  • Loading branch information
pascalgrimaud authored Jun 19, 2022
2 parents 8acdc6a + 0261ee3 commit fa56fc1
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/webapp/app/springboot/domain/SetupService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export interface SetupService {}
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 @@ -13,6 +13,7 @@ import { ProjectHistoryService } from '@/common/domain/ProjectHistoryService';
import { History } from '@/common/domain/History';
import { ProjectService } from '../domain/ProjectService';
import { StoreGeneric } from 'pinia';
import { SetupGeneratorVue } from '@/springboot/primary/generator/setup-generator';

export default defineComponent({
name: 'GeneratorComponent',
Expand All @@ -21,6 +22,7 @@ export default defineComponent({
IconVue,
DefaultButtonVue,
ProjectGeneratorVue,
SetupGeneratorVue,
SpringBootGeneratorVue,
AngularGeneratorVue,
ReactGeneratorVue,
Expand Down
19 changes: 18 additions & 1 deletion src/main/webapp/app/springboot/primary/Generator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
<div class="focus-helper" tabindex="-1"></div>
<button
id="section-init"
class="nav-link text-primary bg-primary fw-bold active"
class="nav-link text-primary bg-setup fw-bold active"
data-bs-toggle="tab"
data-bs-target="#v-pills-init"
role="tab"
Expand All @@ -329,6 +329,22 @@
INITIALIZATION
</button>
</li>
<li class="nav-item">
<div class="q-focus-helper" tabindex="-1"></div>
<button
id="section-setup"
data-selector="section-setup"
class="nav-link bg-setup fw-bold text-setup"
data-bs-toggle="tab"
data-bs-target="#v-pills-setup"
role="tab"
aria-controls="v-pills-setup"
aria-selected="true"
>
<IconVue :name="'code-slash'" :aria-hidden="true" />
SETUP
</button>
</li>

<li v-if="server === 'springboot'" class="nav-item">
<div class="q-focus-helper" tabindex="-1"></div>
Expand Down Expand Up @@ -459,6 +475,7 @@
<div class="col py-2">
<div id="v-pills-tab" class="tab-content">
<ProjectGeneratorVue :build-tool="buildTool" :setup-tool="setupTool" :project="project" />
<SetupGeneratorVue :project="project" />
<SpringBootGeneratorVue v-if="server === 'springboot'" :project="project" />
<AngularGeneratorVue v-if="client === 'angular'" :project="project" />
<ReactGeneratorVue v-if="client === 'react'" :project="project" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineComponent } from 'vue';
import { GeneratorButtonVue } from '@/springboot/primary/generator/generator-button';

export default defineComponent({
name: 'SetupGeneratorComponent',

components: {
GeneratorButtonVue,
},
props: {
project: {
type: Object,
required: true,
},
},
setup() {
return {};
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<div id="v-pills-setup" class="tab-pane fade" role="tabpanel" aria-labelledby="v-pills-profile-tab">
<div class="d-flex flex-column gap-3"></div>
</div>
</template>

<script lang="ts" src="./SetupGenerator.component.ts"></script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import SetupGeneratorComponent from './SetupGenerator.component';
import SetupGeneratorVue from './SetupGenerator.vue';

export { SetupGeneratorComponent, SetupGeneratorVue };
8 changes: 8 additions & 0 deletions src/main/webapp/content/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
--bs-vue-rgb: 63, 178, 127;
--bs-angular-rgb: 195, 0, 47;
--bs-spring-rgb: 109, 179, 63;
--bs-setup-rgb: 125, 60, 152;
--bs-svelte-rgb: 255, 62, 0;
--primary-color-light: #4ba8f8;
--success-color: #00543c;
Expand Down Expand Up @@ -202,6 +203,13 @@ input[type='radio'] {
color: var(--primary-color);
border-color: var(--primary-color);
}
.bg-setup {
--bs-bg-opacity: 0.05;
background-color: rgba(var(--bs-setup-rgb), var(--bs-bg-opacity)) !important;
}
.text-setup {
color: rgba(var(--bs-setup-rgb)) !important;
}
.bg-spring {
--bs-bg-opacity: 0.05;
background-color: rgba(var(--bs-spring-rgb), var(--bs-bg-opacity)) !important;
Expand Down
4 changes: 4 additions & 0 deletions src/test/javascript/cypress/integration/Generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ describe('Generator', () => {
cy.get(projectGeneratorSelector('add-download-button')).should('not.exist');
});

it('should display setup', () => {
cy.get(dataSelector('section-setup')).contains('SETUP');
});

it('should display spring boot', () => {
cy.get(generatorSelector('option-springboot')).check();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { SetupService } from '../../../../../main/webapp/app/springboot/domain/SetupService';

export interface SetupServiceFixture extends SetupService {}

export const stubSetupService = (): SetupServiceFixture => ({});
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { shallowMount, VueWrapper } from '@vue/test-utils';
import { AlertBus } from '@/common/domain/alert/AlertBus';
import { ProjectToUpdate } from '@/springboot/primary/ProjectToUpdate';
import { stubAlertBus } from '../../../../common/domain/AlertBus.fixture';
import { createProjectToUpdate } from '../../ProjectToUpdate.fixture';
import { stubSetupService } from '../../../domain/SetupService.fixture';
import { SetupService } from '@/springboot/domain/SetupService';
import { SetupGeneratorVue } from '@/springboot/primary/generator/setup-generator';

let wrapper: VueWrapper;
let component: any;

interface WrapperOptions {
alertBus: AlertBus;
setupService: SetupService;
project: ProjectToUpdate;
}
const wrap = (wrapperOptions?: Partial<WrapperOptions>) => {
const { alertBus, setupService, project }: WrapperOptions = {
alertBus: stubAlertBus(),
setupService: stubSetupService(),
project: createProjectToUpdate(),
...wrapperOptions,
};
wrapper = shallowMount(SetupGeneratorVue, {
props: {
project,
},
global: {
provide: {
alertBus,
setupService,
},
},
});
component = wrapper.vm;
};
describe('SetupGenerator', () => {
it('should exist', () => {
wrap();

expect(wrapper.exists()).toBe(true);
});
});

0 comments on commit fa56fc1

Please sign in to comment.