Commit 71f638d7 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'psi-cadence-finish-form-fields' into 'master'

Add rollover and description to Iteration Cadence form

See merge request gitlab-org/gitlab!62755
parents 5180d4c0 77595731
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
GlFormGroup, GlFormGroup,
GlFormInput, GlFormInput,
GlFormSelect, GlFormSelect,
GlFormTextarea,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { convertToGraphQLId } from '~/graphql_shared/utils'; import { convertToGraphQLId } from '~/graphql_shared/utils';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
...@@ -34,11 +35,18 @@ const i18n = Object.freeze({ ...@@ -34,11 +35,18 @@ const i18n = Object.freeze({
description: s__('Iterations|The duration for each iteration (in weeks)'), description: s__('Iterations|The duration for each iteration (in weeks)'),
placeholder: s__('Iterations|Select duration'), placeholder: s__('Iterations|Select duration'),
}, },
rollOver: {
label: s__('Iterations|Roll over issues'),
description: s__('Iterations|Move incomplete issues to the next iteration'),
},
futureIterations: { futureIterations: {
label: s__('Iterations|Future iterations'), label: s__('Iterations|Future iterations'),
description: s__('Iterations|Number of future iterations you would like to have scheduled'), description: s__('Iterations|Number of future iterations you would like to have scheduled'),
placeholder: s__('Iterations|Select number'), placeholder: s__('Iterations|Select number'),
}, },
description: {
label: __('Description'),
},
edit: { edit: {
title: s__('Iterations|Edit iteration cadence'), title: s__('Iterations|Edit iteration cadence'),
save: s__('Iterations|Save cadence'), save: s__('Iterations|Save cadence'),
...@@ -72,6 +80,7 @@ export default { ...@@ -72,6 +80,7 @@ export default {
GlFormGroup, GlFormGroup,
GlFormInput, GlFormInput,
GlFormSelect, GlFormSelect,
GlFormTextarea,
}, },
inject: ['groupPath', 'cadencesListPath'], inject: ['groupPath', 'cadencesListPath'],
data() { data() {
...@@ -86,9 +95,11 @@ export default { ...@@ -86,9 +95,11 @@ export default {
errorMessage: '', errorMessage: '',
title: '', title: '',
automatic: true, automatic: true,
rollOver: false,
startDate: null, startDate: null,
durationInWeeks: 0, durationInWeeks: 0,
iterationsInAdvance: 0, iterationsInAdvance: 0,
description: '',
validationState: { validationState: {
title: null, title: null,
startDate: null, startDate: null,
...@@ -133,6 +144,7 @@ export default { ...@@ -133,6 +144,7 @@ export default {
durationInWeeks: this.durationInWeeks, durationInWeeks: this.durationInWeeks,
active: true, active: true,
iterationsInAdvance: this.iterationsInAdvance, iterationsInAdvance: this.iterationsInAdvance,
description: this.description,
}, },
}; };
...@@ -168,7 +180,9 @@ export default { ...@@ -168,7 +180,9 @@ export default {
this.automatic = cadence.automatic; this.automatic = cadence.automatic;
this.startDate = cadence.startDate; this.startDate = cadence.startDate;
this.durationInWeeks = cadence.durationInWeeks; this.durationInWeeks = cadence.durationInWeeks;
this.rollOver = cadence.rollOver;
this.iterationsInAdvance = cadence.iterationsInAdvance; this.iterationsInAdvance = cadence.iterationsInAdvance;
this.description = cadence.description;
}, },
error(error) { error(error) {
this.errorMessage = error; this.errorMessage = error;
...@@ -345,6 +359,17 @@ export default { ...@@ -345,6 +359,17 @@ export default {
/> />
</gl-form-group> </gl-form-group>
<gl-form-group
:label-cols-md="2"
label-class="gl-font-weight-bold text-right-md gl-pt-3!"
label-for="cadence-rollover-issues"
:description="i18n.rollOver.description"
>
<gl-form-checkbox id="cadence-rollover-issues" v-model="rollOver" @change="clearValidation">
<span class="gl-font-weight-bold">{{ i18n.rollOver.label }}</span>
</gl-form-checkbox>
</gl-form-group>
<gl-form-group <gl-form-group
:label="i18n.futureIterations.label" :label="i18n.futureIterations.label"
:label-cols-md="2" :label-cols-md="2"
...@@ -367,6 +392,16 @@ export default { ...@@ -367,6 +392,16 @@ export default {
/> />
</gl-form-group> </gl-form-group>
<gl-form-group
:label="i18n.description.label"
:label-cols-md="2"
:content-cols-md="2"
label-class="text-right-md gl-pt-3!"
label-for="cadence-description"
>
<gl-form-textarea id="cadence-description" v-model="description" class="w-100" />
</gl-form-group>
<div class="form-actions gl-display-flex"> <div class="form-actions gl-display-flex">
<gl-button <gl-button
:loading="loading" :loading="loading"
...@@ -377,7 +412,7 @@ export default { ...@@ -377,7 +412,7 @@ export default {
> >
{{ i18n[page].save }} {{ i18n[page].save }}
</gl-button> </gl-button>
<gl-button class="ml-auto" data-testid="cancel-create-cadence" @click="cancel"> <gl-button class="gl-ml-3" data-testid="cancel-create-cadence" @click="cancel">
{{ i18n.cancel }} {{ i18n.cancel }}
</gl-button> </gl-button>
</div> </div>
......
...@@ -3,6 +3,8 @@ fragment IterationCadence on IterationCadence { ...@@ -3,6 +3,8 @@ fragment IterationCadence on IterationCadence {
title title
automatic automatic
startDate startDate
rollOver
durationInWeeks durationInWeeks
iterationsInAdvance iterationsInAdvance
description
} }
#import "./iteration_cadence.fragment.graphql" #import "./iteration_cadence.fragment.graphql"
# todo: should this use IterationsCadenceID! ? # todo: should this use IterationsCadenceID! ?
query IterationCadences($fullPath: ID!, $id: ID!) { query IterationCadence($fullPath: ID!, $id: ID!) {
group(fullPath: $fullPath) { group(fullPath: $fullPath) {
iterationCadences(id: $id) { iterationCadences(id: $id) {
nodes { nodes {
......
...@@ -4,8 +4,7 @@ import Vue, { nextTick } from 'vue'; ...@@ -4,8 +4,7 @@ import Vue, { nextTick } from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import IterationCadenceForm from 'ee/iterations/components/iteration_cadence_form.vue'; import IterationCadenceForm from 'ee/iterations/components/iteration_cadence_form.vue';
import createCadence from 'ee/iterations/queries/cadence_create.mutation.graphql'; import createCadence from 'ee/iterations/queries/cadence_create.mutation.graphql';
import readCadence from 'ee/iterations/queries/iteration_cadence.query.graphql'; import getCadence from 'ee/iterations/queries/iteration_cadence.query.graphql';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper';
...@@ -33,8 +32,11 @@ describe('Iteration cadence form', () => { ...@@ -33,8 +32,11 @@ describe('Iteration cadence form', () => {
id: `gid://gitlab/Iterations::Cadence/${id}`, id: `gid://gitlab/Iterations::Cadence/${id}`,
title: 'An iteration', title: 'An iteration',
automatic: true, automatic: true,
startDate: '2020-06-28', rollOver: false,
durationInWeeks: '3', durationInWeeks: '3',
description: 'The words',
duration: '3',
startDate: '2020-06-28',
iterationsInAdvance: '2', iterationsInAdvance: '2',
}; };
...@@ -80,7 +82,7 @@ describe('Iteration cadence form', () => { ...@@ -80,7 +82,7 @@ describe('Iteration cadence form', () => {
const findAutomatedSchedulingGroup = () => wrapper.findAllComponents(GlFormGroup).at(1); const findAutomatedSchedulingGroup = () => wrapper.findAllComponents(GlFormGroup).at(1);
const findStartDateGroup = () => wrapper.findAllComponents(GlFormGroup).at(2); const findStartDateGroup = () => wrapper.findAllComponents(GlFormGroup).at(2);
const findDurationGroup = () => wrapper.findAllComponents(GlFormGroup).at(3); const findDurationGroup = () => wrapper.findAllComponents(GlFormGroup).at(3);
const findFutureIterationsGroup = () => wrapper.findAllComponents(GlFormGroup).at(4); const findFutureIterationsGroup = () => wrapper.findAllComponents(GlFormGroup).at(5);
const findError = () => wrapper.findComponent(GlAlert); const findError = () => wrapper.findComponent(GlAlert);
...@@ -88,6 +90,7 @@ describe('Iteration cadence form', () => { ...@@ -88,6 +90,7 @@ describe('Iteration cadence form', () => {
const findStartDate = () => wrapper.find('#cadence-start-date'); const findStartDate = () => wrapper.find('#cadence-start-date');
const findFutureIterations = () => wrapper.find('#cadence-schedule-future-iterations'); const findFutureIterations = () => wrapper.find('#cadence-schedule-future-iterations');
const findDuration = () => wrapper.find('#cadence-duration'); const findDuration = () => wrapper.find('#cadence-duration');
const findDescription = () => wrapper.find('#cadence-description');
const setTitle = (value) => findTitle().vm.$emit('input', value); const setTitle = (value) => findTitle().vm.$emit('input', value);
const setStartDate = (value) => findStartDate().vm.$emit('input', value); const setStartDate = (value) => findStartDate().vm.$emit('input', value);
...@@ -149,6 +152,7 @@ describe('Iteration cadence form', () => { ...@@ -149,6 +152,7 @@ describe('Iteration cadence form', () => {
durationInWeeks, durationInWeeks,
iterationsInAdvance, iterationsInAdvance,
active: true, active: true,
description: '',
}, },
}); });
}); });
...@@ -222,6 +226,7 @@ describe('Iteration cadence form', () => { ...@@ -222,6 +226,7 @@ describe('Iteration cadence form', () => {
startDate, startDate,
durationInWeeks, durationInWeeks,
iterationsInAdvance: 0, iterationsInAdvance: 0,
description: '',
active: true, active: true,
}, },
}); });
...@@ -230,11 +235,13 @@ describe('Iteration cadence form', () => { ...@@ -230,11 +235,13 @@ describe('Iteration cadence form', () => {
}); });
describe('Edit cadence', () => { describe('Edit cadence', () => {
const query = readCadence; const query = getCadence;
const resolverMock = jest.fn().mockResolvedValue(getCadenceSuccess); const resolverMock = jest.fn().mockResolvedValue(getCadenceSuccess);
beforeEach(() => { beforeEach(() => {
$router.currentRoute.params.cadenceId = id; $router.currentRoute.params.cadenceId = id;
createComponent({ query, resolverMock });
}); });
afterEach(() => { afterEach(() => {
...@@ -242,8 +249,6 @@ describe('Iteration cadence form', () => { ...@@ -242,8 +249,6 @@ describe('Iteration cadence form', () => {
}); });
it('shows correct title and button text', () => { it('shows correct title and button text', () => {
createComponent({ query, resolverMock });
expect(wrapper.text()).toContain(wrapper.vm.i18n.edit.title); expect(wrapper.text()).toContain(wrapper.vm.i18n.edit.title);
expect(wrapper.text()).toContain(wrapper.vm.i18n.edit.save); expect(wrapper.text()).toContain(wrapper.vm.i18n.edit.save);
}); });
...@@ -273,6 +278,7 @@ describe('Iteration cadence form', () => { ...@@ -273,6 +278,7 @@ describe('Iteration cadence form', () => {
expect(findStartDate().element.value).toBe(iterationCadence.startDate); expect(findStartDate().element.value).toBe(iterationCadence.startDate);
expect(findFutureIterations().element.value).toBe(iterationCadence.iterationsInAdvance); expect(findFutureIterations().element.value).toBe(iterationCadence.iterationsInAdvance);
expect(findDuration().element.value).toBe(iterationCadence.durationInWeeks); expect(findDuration().element.value).toBe(iterationCadence.durationInWeeks);
expect(findDescription().element.value).toBe(iterationCadence.description);
}); });
}); });
}); });
...@@ -18595,6 +18595,9 @@ msgstr "" ...@@ -18595,6 +18595,9 @@ msgstr ""
msgid "Iterations|Iteration scheduling will be handled automatically" msgid "Iterations|Iteration scheduling will be handled automatically"
msgstr "" msgstr ""
msgid "Iterations|Move incomplete issues to the next iteration"
msgstr ""
msgid "Iterations|New iteration cadence" msgid "Iterations|New iteration cadence"
msgstr "" msgstr ""
...@@ -18607,6 +18610,9 @@ msgstr "" ...@@ -18607,6 +18610,9 @@ msgstr ""
msgid "Iterations|Number of future iterations you would like to have scheduled" msgid "Iterations|Number of future iterations you would like to have scheduled"
msgstr "" msgstr ""
msgid "Iterations|Roll over issues"
msgstr ""
msgid "Iterations|Save cadence" msgid "Iterations|Save cadence"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment