Commit 6721c424 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'dfosco/remove-env-survey' into 'master'

Remove environments survey alert

See merge request gitlab-org/gitlab!69765
parents 08f47493 e6ad51fd
<script>
import { GlBadge, GlButton, GlModalDirective, GlTab, GlTabs, GlAlert } from '@gitlab/ui';
import { GlBadge, GlButton, GlModalDirective, GlTab, GlTabs } from '@gitlab/ui';
import createFlash from '~/flash';
import { setCookie, getCookie, parseBoolean } from '~/lib/utils/common_utils';
import { s__ } from '~/locale';
import { ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME } from '../constants';
import eventHub from '../event_hub';
import environmentsMixin from '../mixins/environments_mixin';
import EnvironmentsPaginationApiMixin from '../mixins/environments_pagination_api_mixin';
......@@ -17,12 +15,6 @@ export default {
i18n: {
newEnvironmentButtonLabel: s__('Environments|New environment'),
reviewAppButtonLabel: s__('Environments|Enable review app'),
surveyAlertTitle: s__('Environments|Help us improve environments'),
surveyAlertText: s__(
'Environments|Your feedback helps GitLab make environments better for you and other users. Participate and enter a sweepstake to win a USD 30 gift card.',
),
surveyAlertButtonLabel: s__('Environments|Take the survey'),
surveyDismissButtonLabel: s__('Environments|Dismiss'),
},
modal: {
id: 'enable-review-app-info',
......@@ -33,7 +25,6 @@ export default {
EnableReviewAppModal,
GlBadge,
GlButton,
GlAlert,
GlTab,
GlTabs,
StopEnvironmentModal,
......@@ -61,13 +52,6 @@ export default {
required: true,
},
},
data() {
return {
environmentsSurveyAlertDismissed: parseBoolean(
getCookie(ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME),
),
};
},
created() {
eventHub.$on('toggleFolder', this.toggleFolder);
......@@ -117,11 +101,6 @@ export default {
openFolders.forEach((folder) => this.fetchChildEnvironments(folder));
}
},
onSurveyAlertDismiss() {
setCookie(ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME, 'true');
this.environmentsSurveyAlertDismissed = true;
},
},
};
</script>
......@@ -152,19 +131,6 @@ export default {
>{{ $options.i18n.newEnvironmentButtonLabel }}</gl-button
>
</div>
<gl-alert
v-if="!environmentsSurveyAlertDismissed"
class="gl-my-4"
:title="$options.i18n.surveyAlertTitle"
:primary-button-text="$options.i18n.surveyAlertButtonLabel"
variant="info"
dismissible
:dismiss-label="$options.i18n.surveyDismissButtonLabel"
primary-button-link="https://gitlab.fra1.qualtrics.com/jfe/form/SV_a2xyFsAA4D0w0Jg"
@dismiss="onSurveyAlertDismiss"
>
{{ $options.i18n.surveyAlertText }}
</gl-alert>
<gl-tabs :value="activeTab" content-class="gl-display-none">
<gl-tab
v-for="(tab, idx) in tabs"
......
......@@ -38,5 +38,3 @@ export const CANARY_STATUS = {
};
export const CANARY_UPDATE_MODAL = 'confirm-canary-change';
export const ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME = 'environments_survey_alert_dismissed';
......@@ -12853,9 +12853,6 @@ msgstr ""
msgid "Environments|Deployment %{status}"
msgstr ""
msgid "Environments|Dismiss"
msgstr ""
msgid "Environments|Enable review app"
msgstr ""
......@@ -12868,9 +12865,6 @@ msgstr ""
msgid "Environments|Environments are places where code gets deployed, such as staging or production."
msgstr ""
msgid "Environments|Help us improve environments"
msgstr ""
msgid "Environments|Install Elastic Stack on your cluster to enable advanced querying capabilities such as full text search."
msgstr ""
......@@ -12946,9 +12940,6 @@ msgstr ""
msgid "Environments|Stopping %{environmentName}"
msgstr ""
msgid "Environments|Take the survey"
msgstr ""
msgid "Environments|There was an error fetching the logs. Please try again."
msgstr ""
......@@ -12970,9 +12961,6 @@ msgstr ""
msgid "Environments|You don't have any environments right now"
msgstr ""
msgid "Environments|Your feedback helps GitLab make environments better for you and other users. Participate and enter a sweepstake to win a USD 30 gift card."
msgstr ""
msgid "Environments|by %{avatar}"
msgstr ""
......
import { GlTabs, GlAlert } from '@gitlab/ui';
import { GlTabs } from '@gitlab/ui';
import { mount, shallowMount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
......@@ -7,9 +7,7 @@ import DeployBoard from '~/environments/components/deploy_board.vue';
import EmptyState from '~/environments/components/empty_state.vue';
import EnableReviewAppModal from '~/environments/components/enable_review_app_modal.vue';
import EnvironmentsApp from '~/environments/components/environments_app.vue';
import { ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME } from '~/environments/constants';
import axios from '~/lib/utils/axios_utils';
import { setCookie, getCookie, removeCookie } from '~/lib/utils/common_utils';
import * as urlUtils from '~/lib/utils/url_utility';
import { environment, folder } from './mock_data';
......@@ -49,7 +47,6 @@ describe('Environment', () => {
const findNewEnvironmentButton = () => wrapper.findByTestId('new-environment');
const findEnvironmentsTabAvailable = () => wrapper.find('.js-environments-tab-available > a');
const findEnvironmentsTabStopped = () => wrapper.find('.js-environments-tab-stopped > a');
const findSurveyAlert = () => wrapper.find(GlAlert);
beforeEach(() => {
mock = new MockAdapter(axios);
......@@ -282,49 +279,4 @@ describe('Environment', () => {
expect(wrapper.findComponent(GlTabs).attributes('value')).toBe('1');
});
});
describe('survey alert', () => {
beforeEach(async () => {
mockRequest(200, { environments: [] });
await createWrapper(true);
});
afterEach(() => {
removeCookie(ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME);
});
describe('when the user has not dismissed the alert', () => {
it('shows the alert', () => {
expect(findSurveyAlert().exists()).toBe(true);
});
describe('when the user dismisses the alert', () => {
beforeEach(() => {
findSurveyAlert().vm.$emit('dismiss');
});
it('hides the alert', () => {
expect(findSurveyAlert().exists()).toBe(false);
});
it('persists the dismisal using a cookie', () => {
const cookieValue = getCookie(ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME);
expect(cookieValue).toBe('true');
});
});
});
describe('when the user has previously dismissed the alert', () => {
beforeEach(async () => {
setCookie(ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME, 'true');
await createWrapper(true);
});
it('does not show the alert', () => {
expect(findSurveyAlert().exists()).toBe(false);
});
});
});
});
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