Commit 3f38ea4f authored by Axel García's avatar Axel García

Refactor documentation links for SP disabled

Changelog: other
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67384
EE: true
parent cdc32a72
<script>
import { GlEmptyState, GlSprintf, GlLink, GlButton } from '@gitlab/ui';
import { helpPagePath } from '~/helpers/help_page_helper';
export default {
components: {
......@@ -15,13 +16,11 @@ export default {
svgPath: {
default: '',
},
docsLink: {
default: '',
},
primaryButtonPath: {
default: '',
},
},
docsLink: helpPagePath('development/service_ping/index.md'),
};
</script>
<template>
......@@ -36,7 +35,7 @@ export default {
"
>
<template #docLink="{ content }">
<gl-link :href="docsLink" target="_blank" data-testid="docs-link">{{ content }}</gl-link>
<gl-link :href="$options.docsLink" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
<template v-else>
......@@ -44,12 +43,7 @@ export default {
{{ s__('ServicePing|Turn on service ping to review instance-level analytics.') }}
</p>
<gl-button
category="primary"
variant="success"
:href="primaryButtonPath"
data-testid="power-on-button"
>
<gl-button category="primary" variant="success" :href="primaryButtonPath">
{{ s__('ServicePing|Turn on service ping') }}
</gl-button>
</template>
......
......@@ -11,12 +11,7 @@ export default () => {
if (!emptyStateContainer) return false;
const {
isAdmin,
emptyStateSvgPath,
enableServicePingPath,
docsLink,
} = emptyStateContainer.dataset;
const { isAdmin, emptyStateSvgPath, enableServicePingPath } = emptyStateContainer.dataset;
return new Vue({
el: emptyStateContainer,
......@@ -24,7 +19,6 @@ export default () => {
isAdmin: parseBoolean(isAdmin),
svgPath: emptyStateSvgPath,
primaryButtonPath: enableServicePingPath,
docsLink,
},
render(h) {
return h(ServicePingDisabled);
......
......@@ -4,6 +4,6 @@
= _('DevOps Report')
- if !service_ping_enabled
#js-devops-service-ping-disabled{ data: { is_admin: current_user&.admin.to_s, empty_state_svg_path: image_path('illustrations/convdev/convdev_no_index.svg'), enable_service_ping_path: metrics_and_profiling_admin_application_settings_path(anchor: 'js-usage-settings'), docs_link: help_page_path('development/service_ping/index.md') } }
#js-devops-service-ping-disabled{ data: { is_admin: current_user&.admin.to_s, empty_state_svg_path: image_path('illustrations/convdev/convdev_no_index.svg'), enable_service_ping_path: metrics_and_profiling_admin_application_settings_path(anchor: 'js-usage-settings') } }
- else
.js-devops-adoption{ data: { empty_state_svg_path: image_path('illustrations/monitoring/getting_started.svg'), devops_score_metrics: devops_score_metrics(@metric).to_json, devops_report_docs_path: help_page_path('user/admin_area/analytics/dev_ops_report'), no_data_image_path: image_path('dev_ops_report_no_data.svg'), devops_score_intro_image_path: image_path('dev_ops_report_overview.svg') } }
import { GlEmptyState, GlSprintf } from '@gitlab/ui';
import { TEST_HOST } from 'helpers/test_constants';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import ServicePingDisabled from '~/analytics/devops_report/components/service_ping_disabled.vue';
describe('~/analytics/devops_report/components/service_ping_disabled.vue', () => {
......@@ -11,21 +11,19 @@ describe('~/analytics/devops_report/components/service_ping_disabled.vue', () =>
});
const createWrapper = ({ isAdmin = false } = {}) => {
wrapper = shallowMountExtended(ServicePingDisabled, {
wrapper = mountExtended(ServicePingDisabled, {
provide: {
isAdmin,
svgPath: TEST_HOST,
docsLink: TEST_HOST,
primaryButtonPath: TEST_HOST,
},
stubs: { GlEmptyState, GlSprintf },
});
};
const findEmptyState = () => wrapper.findComponent(GlEmptyState);
const findMessageForRegularUsers = () => wrapper.findComponent(GlSprintf);
const findDocsLink = () => wrapper.findByTestId('docs-link');
const findPowerOnButton = () => wrapper.findByTestId('power-on-button');
const findDocsLink = () => wrapper.findByRole('link', { name: 'service ping' });
const findPowerOnButton = () => wrapper.findByRole('link', { name: 'Turn on service ping' });
it('renders empty state with provided SVG path', () => {
createWrapper();
......@@ -45,7 +43,7 @@ describe('~/analytics/devops_report/components/service_ping_disabled.vue', () =>
it('renders docs link', () => {
expect(findDocsLink().exists()).toBe(true);
expect(findDocsLink().attributes('href')).toBe(TEST_HOST);
expect(findDocsLink().attributes('href')).toBe('/help/development/service_ping/index.md');
});
});
......
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