Commit 778f6a29 authored by Florie Guibert's avatar Florie Guibert

Ensure we don't show warning when there are <1000 epics on a roadmap

Review feedback
parent 760e1ccb
......@@ -2,7 +2,7 @@
import Cookies from 'js-cookie';
import { GlLoadingIcon, GlAlert } from '@gitlab/ui';
import { mapState, mapActions } from 'vuex';
import { __ } from '~/locale';
import { __, s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import EpicsListEmpty from './epics_list_empty.vue';
......@@ -10,13 +10,17 @@ import RoadmapFilters from './roadmap_filters.vue';
import RoadmapShell from './roadmap_shell.vue';
import eventHub from '../event_hub';
import { EXTEND_AS, EPICS_LIMIT_DISMISSED_COOKIE_NAME } from '../constants';
import {
EXTEND_AS,
EPICS_LIMIT_DISMISSED_COOKIE_NAME,
EPICS_LIMIT_DISMISSED_COOKIE_TIMEOUT,
} from '../constants';
export default {
i18n: {
warningTitle: __('Some of your epics may not be visible'),
warningBody: __(
'Roadmaps are limited to 1,000 epics. These will display in your selected sort order.',
warningTitle: s__('GroupRoadmap|Some of your epics might not be visible'),
warningBody: s__(
'GroupRoadmap|Roadmaps can display up to 1,000 epics. These appear in your selected sort order.',
),
warningButtonLabel: __('Learn more'),
},
......@@ -144,7 +148,9 @@ export default {
});
},
dismissTooManyEpicsWarning() {
Cookies.set(EPICS_LIMIT_DISMISSED_COOKIE_NAME, 'true', { expires: 365 });
Cookies.set(EPICS_LIMIT_DISMISSED_COOKIE_NAME, 'true', {
expires: EPICS_LIMIT_DISMISSED_COOKIE_TIMEOUT,
});
this.isWarningDismissed = true;
},
},
......
......@@ -65,3 +65,5 @@ export const EPIC_LEVEL_MARGIN = {
};
export const EPICS_LIMIT_DISMISSED_COOKIE_NAME = 'epics_limit_warning_dismissed';
export const EPICS_LIMIT_DISMISSED_COOKIE_TIMEOUT = 365;
......@@ -156,7 +156,7 @@ RSpec.describe 'group epic roadmap', :js do
end
end
context 'when over 1000 epics exist for the group' do
context 'when over 1000 epics match roadmap filters' do
before do
create_list(:epic, 2, group: group, start_date: 10.days.ago, end_date: 1.day.ago)
visit group_roadmap_path(group)
......@@ -168,7 +168,7 @@ RSpec.describe 'group epic roadmap', :js do
it 'renders warning callout banner' do
page.within('.content-wrapper .content') do
expect(page).to have_selector('[data-testid="epics_limit_callout"]', count: 1)
expect(find('[data-testid="epics_limit_callout"]')).to have_content 'Some of your epics may not be visible Roadmaps are limited to 1,000 epics. These will display in your selected sort order.'
expect(find('[data-testid="epics_limit_callout"]')).to have_content 'Some of your epics might not be visible Roadmaps can display up to 1,000 epics. These appear in your selected sort order.'
end
page.within('[data-testid="epics_limit_callout"]') do
......
......@@ -245,16 +245,14 @@ describe('RoadmapApp', () => {
describe('roadmap epics limit warning', () => {
beforeEach(() => {
wrapper = createComponent();
Cookies.set('epics_limit_warning_dismissed', false);
store.commit(types.RECEIVE_EPICS_SUCCESS, [mockFormattedEpic, mockFormattedChildEpic2]);
window.gon.roadmap_epics_limit = 1;
});
it('displays warning when epics limit is reached', () => {
expect(Cookies.get('epics_limit_warning_dismissed')).toBe('false');
expect(wrapper.find(GlAlert).exists()).toBe(true);
expect(wrapper.find(GlAlert).text()).toContain(
'Roadmaps are limited to 1,000 epics. These will display in your selected sort order.',
'Roadmaps can display up to 1,000 epics. These appear in your selected sort order.',
);
});
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe EE::Gitlab::GonHelper do
let(:helper) do
Class.new do
include Gitlab::GonHelper
def current_user
nil
end
end.new
end
describe '#add_gon_variables' do
let(:gon) { instance_double('gon').as_null_object }
before do
allow(helper).to receive(:gon).and_return(gon)
end
it 'includes ee exclusive settings' do
expect(gon).to receive(:roadmap_epics_limit=).with(1000)
helper.add_gon_variables
end
end
end
......@@ -13270,6 +13270,12 @@ msgstr ""
msgid "GroupRoadmap|No start date – %{dateWord}"
msgstr ""
msgid "GroupRoadmap|Roadmaps can display up to 1,000 epics. These appear in your selected sort order."
msgstr ""
msgid "GroupRoadmap|Some of your epics might not be visible"
msgstr ""
msgid "GroupRoadmap|Something went wrong while fetching epics"
msgstr ""
......@@ -23357,9 +23363,6 @@ msgstr ""
msgid "Roadmap"
msgstr ""
msgid "Roadmaps are limited to 1,000 epics. These will display in your selected sort order."
msgstr ""
msgid "Role"
msgstr ""
......@@ -25251,9 +25254,6 @@ msgstr ""
msgid "Some of the designs you tried uploading did not change:"
msgstr ""
msgid "Some of your epics may not be visible"
msgstr ""
msgid "Someone edited the issue at the same time you did. Please check out %{linkStart}the issue%{linkEnd} and make sure your changes will not unintentionally remove theirs."
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