Commit 2cc20cd4 authored by Donald Cook's avatar Donald Cook Committed by Olena Horal-Koretska

Updated iterations on sidebar to only show opened state

parent 005e9e5d
......@@ -12,7 +12,7 @@ import {
import groupIterationsQuery from '../queries/group_iterations.query.graphql';
import currentIterationQuery from '../queries/issue_iteration.query.graphql';
import setIssueIterationMutation from '../queries/set_iteration_on_issue.mutation.graphql';
import { iterationSelectTextMap } from '../constants';
import { iterationSelectTextMap, iterationDisplayState } from '../constants';
import { deprecatedCreateFlash as createFlash } from '~/flash';
export default {
......@@ -71,6 +71,7 @@ export default {
return {
fullPath: this.groupPath,
title: search,
state: iterationDisplayState,
};
},
update(data) {
......
......@@ -19,6 +19,8 @@ export const iterationSelectTextMap = {
iterationSelectFail: __('Failed to set iteration on this issue. Please try again.'),
};
export const iterationDisplayState = 'opened';
export const healthStatusForRestApi = {
NO_STATUS: '0',
[healthStatus.ON_TRACK]: 'on_track',
......
query groupIterations($fullPath: ID!, $title: String) {
query groupIterations($fullPath: ID!, $title: String, $state: IterationState) {
group(fullPath: $fullPath) {
iterations(title: $title) {
iterations(title: $title, state: $state) {
nodes {
id
title
......
......@@ -132,6 +132,7 @@ RSpec.describe 'Issue Sidebar' do
context 'Iterations', :js do
context 'when iterations feature available' do
let_it_be(:iteration) { create(:iteration, group: group, start_date: 1.day.from_now, due_date: 2.days.from_now, title: 'Iteration 1') }
let_it_be(:iteration2) { create(:iteration, group: group, start_date: 2.days.ago, due_date: 1.day.ago, title: 'Iteration 2', state: 'closed', skip_future_date_validation: true) }
before do
iteration
......@@ -157,6 +158,14 @@ RSpec.describe 'Issue Sidebar' do
expect(page.find('[data-testid="select-iteration"]')).to have_content('No iteration')
end
it 'does not show closed iterations' do
find_and_click_edit_iteration
page.within '.milestone' do
expect(page).not_to have_content iteration2.title
end
end
end
context 'when a project does not have a group' do
......
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