Commit e0e94d05 authored by Illya Klymov's avatar Illya Klymov

Merge branch '235993-cohorts-improve-empty-state-to-match-devops-score' into 'master'

[Cohorts] Improve empty state to match DevOps Score

Closes #235993

See merge request gitlab-org/gitlab!39828
parents 7361731d 95e903bf
<script>
import { GlEmptyState, GlSprintf, GlLink } from '@gitlab/ui';
export default {
components: {
GlEmptyState,
GlSprintf,
GlLink,
},
inject: {
svgPath: {
type: String,
},
docsLink: {
type: String,
},
primaryButtonPath: {
type: String,
},
},
};
</script>
<template>
<gl-empty-state
class="js-empty-state"
:title="__('Activate user activity analysis')"
:svg-path="svgPath"
:primary-button-text="__('Turn on usage ping')"
:primary-button-link="primaryButtonPath"
>
<template #description>
<gl-sprintf
:message="
__(
'Turn on %{strongStart}usage ping%{strongEnd} to activate analysis of user activity, known as %{docLinkStart}Cohorts%{docLinkEnd}.',
)
"
>
<template #docLink="{content}">
<gl-link :href="docsLink" target="_blank">{{ content }}</gl-link>
</template>
<template #strong="{ content }"
><strong>{{ content }}</strong></template
>
</gl-sprintf>
</template>
</gl-empty-state>
</template>
import Vue from 'vue';
import UsagePingDisabled from '~/admin/cohorts/components/usage_ping_disabled.vue';
document.addEventListener('DOMContentLoaded', () => {
const emptyStateContainer = document.getElementById('js-cohorts-empty-state');
if (!emptyStateContainer) return false;
const { emptyStateSvgPath, enableUsagePingLink, docsLink } = emptyStateContainer.dataset;
return new Vue({
el: emptyStateContainer,
provide: {
svgPath: emptyStateSvgPath,
primaryButtonPath: enableUsagePingLink,
docsLink,
},
render(h) {
return h(UsagePingDisabled);
},
});
});
...@@ -4,12 +4,4 @@ ...@@ -4,12 +4,4 @@
- if @cohorts - if @cohorts
= render 'cohorts_table' = render 'cohorts_table'
- else - else
.bs-callout.bs-callout-warning.clearfix #js-cohorts-empty-state{ data: { empty_state_svg_path: image_path('illustrations/convdev/convdev_no_index.svg'), enable_usage_ping_link: metrics_and_profiling_admin_application_settings_path(anchor: 'js-usage-settings'), docs_link: help_page_path('user/admin_area/analytics/user_cohorts') } }
%p
- usage_ping_path = help_page_path('development/telemetry/usage_ping')
- usage_ping_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: usage_ping_path }
= s_('User Cohorts are only shown when the %{usage_ping_link_start}usage ping%{usage_ping_link_end} is enabled.').html_safe % { usage_ping_link_start: usage_ping_link_start, usage_ping_link_end: '</a>'.html_safe }
- if current_user.admin?
- application_settings_path = metrics_and_profiling_admin_application_settings_path(anchor: 'js-usage-settings')
- application_settings_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: application_settings_path }
= s_('To enable it and see User Cohorts, visit %{application_settings_link_start}application settings%{application_settings_link_end}.').html_safe % { application_settings_link_start: application_settings_link_start, application_settings_link_end: '</a>'.html_safe }
---
title: Improve empty state for Cohorts to match DevOps Score
merge_request: 39828
author:
type: changed
...@@ -1396,6 +1396,9 @@ msgstr "" ...@@ -1396,6 +1396,9 @@ msgstr ""
msgid "Activate Service Desk" msgid "Activate Service Desk"
msgstr "" msgstr ""
msgid "Activate user activity analysis"
msgstr ""
msgid "Active" msgid "Active"
msgstr "" msgstr ""
...@@ -25809,9 +25812,6 @@ msgstr "" ...@@ -25809,9 +25812,6 @@ msgstr ""
msgid "To define internal users, first enable new users set to external" msgid "To define internal users, first enable new users set to external"
msgstr "" msgstr ""
msgid "To enable it and see User Cohorts, visit %{application_settings_link_start}application settings%{application_settings_link_end}."
msgstr ""
msgid "To further protect your account, consider configuring a %{mfa_link_start}two-factor authentication%{mfa_link_end} method." msgid "To further protect your account, consider configuring a %{mfa_link_start}two-factor authentication%{mfa_link_end} method."
msgstr "" msgstr ""
...@@ -26199,9 +26199,15 @@ msgstr "" ...@@ -26199,9 +26199,15 @@ msgstr ""
msgid "Turn On" msgid "Turn On"
msgstr "" msgstr ""
msgid "Turn on %{strongStart}usage ping%{strongEnd} to activate analysis of user activity, known as %{docLinkStart}Cohorts%{docLinkEnd}."
msgstr ""
msgid "Turn on Service Desk" msgid "Turn on Service Desk"
msgstr "" msgstr ""
msgid "Turn on usage ping"
msgstr ""
msgid "Twitter" msgid "Twitter"
msgstr "" msgstr ""
...@@ -26823,9 +26829,6 @@ msgstr "" ...@@ -26823,9 +26829,6 @@ msgstr ""
msgid "User %{username} was successfully removed." msgid "User %{username} was successfully removed."
msgstr "" msgstr ""
msgid "User Cohorts are only shown when the %{usage_ping_link_start}usage ping%{usage_ping_link_end} is enabled."
msgstr ""
msgid "User IDs" msgid "User IDs"
msgstr "" msgstr ""
......
...@@ -5,15 +5,27 @@ require 'spec_helper' ...@@ -5,15 +5,27 @@ require 'spec_helper'
RSpec.describe 'Cohorts page' do RSpec.describe 'Cohorts page' do
before do before do
sign_in(create(:admin)) sign_in(create(:admin))
end
context 'with usage ping enabled' do
it 'shows users count per month' do
stub_application_setting(usage_ping_enabled: true) stub_application_setting(usage_ping_enabled: true)
end
it 'See users count per month' do
create_list(:user, 2) create_list(:user, 2)
visit admin_cohorts_path visit admin_cohorts_path
expect(page).to have_content("#{Time.now.strftime('%b %Y')} 3 0") expect(page).to have_content("#{Time.now.strftime('%b %Y')} 3 0")
end end
end
context 'with usage ping disabled' do
it 'shows empty state', :js do
stub_application_setting(usage_ping_enabled: false)
visit admin_cohorts_path
expect(page).to have_selector(".js-empty-state")
end
end
end end
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