Commit c93734e6 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'jnnkl-inline-links-dependency-license' into 'master'

Update License Compliance and Dependency List Empty State Pages

See merge request gitlab-org/gitlab!54314
parents c832ff83 4beffc3d
<script> <script>
import { GlEmptyState, GlIcon, GlLoadingIcon, GlSprintf, GlLink, GlButton } from '@gitlab/ui'; import { GlEmptyState, GlIcon, GlLoadingIcon, GlSprintf, GlLink } from '@gitlab/ui';
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { DEPENDENCY_LIST_TYPES } from '../store/constants'; import { DEPENDENCY_LIST_TYPES } from '../store/constants';
...@@ -18,7 +18,6 @@ export default { ...@@ -18,7 +18,6 @@ export default {
GlLoadingIcon, GlLoadingIcon,
GlSprintf, GlSprintf,
GlLink, GlLink,
GlButton,
DependencyListIncompleteAlert, DependencyListIncompleteAlert,
DependencyListJobFailedAlert, DependencyListJobFailedAlert,
PaginatedDependenciesTable, PaginatedDependenciesTable,
...@@ -79,7 +78,7 @@ export default { ...@@ -79,7 +78,7 @@ export default {
description: __( description: __(
'The dependency list details information about the components used within your project.', 'The dependency list details information about the components used within your project.',
), ),
buttonLabel: __('Learn more about the dependency list'), linkText: __('More Information'),
link: this.documentationPath, link: this.documentationPath,
}, },
[REPORT_STATUS.noDependencies]: { [REPORT_STATUS.noDependencies]: {
...@@ -87,7 +86,7 @@ export default { ...@@ -87,7 +86,7 @@ export default {
description: __( description: __(
'It seems like the Dependency Scanning job ran successfully, but no dependencies have been detected in your project.', 'It seems like the Dependency Scanning job ran successfully, but no dependencies have been detected in your project.',
), ),
buttonLabel: __('View supported languages and frameworks'), linkText: __('View supported languages and frameworks'),
link: this.supportDocumentationPath, link: this.supportDocumentationPath,
}, },
}; };
...@@ -122,13 +121,13 @@ export default { ...@@ -122,13 +121,13 @@ export default {
<gl-empty-state <gl-empty-state
v-else-if="showEmptyState" v-else-if="showEmptyState"
:title="emptyStateOptions.title" :title="emptyStateOptions.title"
:description="emptyStateOptions.description"
:svg-path="emptyStateSvgPath" :svg-path="emptyStateSvgPath"
> >
<template #actions> <template #description>
<gl-button variant="info" :href="emptyStateOptions.link"> {{ emptyStateOptions.description }}
{{ emptyStateOptions.buttonLabel }} <gl-link target="_blank" :href="emptyStateOptions.link">
</gl-button> {{ emptyStateOptions.linkText }}
</gl-link>
</template> </template>
</gl-empty-state> </gl-empty-state>
......
...@@ -96,15 +96,19 @@ export default { ...@@ -96,15 +96,19 @@ export default {
<gl-empty-state <gl-empty-state
v-else-if="hasEmptyState" v-else-if="hasEmptyState"
:title="s__('Licenses|View license details for your project')" :title="s__('Licenses|View license details for your project')"
:description="
s__(
'Licenses|The license list details information about the licenses used within your project.',
)
"
:svg-path="emptyStateSvgPath" :svg-path="emptyStateSvgPath"
:primary-button-link="documentationPath" >
:primary-button-text="s__('Licenses|Learn more about license compliance')" <template #description>
/> {{
s__(
'Licenses|The license list details information about the licenses used within your project.',
)
}}
<gl-link target="_blank" :href="documentationPath">
{{ __('More Information') }}
</gl-link>
</template>
</gl-empty-state>
<div v-else> <div v-else>
<gl-alert v-if="hasPolicyViolations" class="mt-3" variant="warning" :dismissible="false"> <gl-alert v-if="hasPolicyViolations" class="mt-3" variant="warning" :dismissible="false">
......
---
title: Update License Compliance and Dependency List Empty State Pages
merge_request: 54314
author:
type: changed
...@@ -21,7 +21,7 @@ RSpec.describe 'EE > Projects > Licenses > Maintainer views policies', :js do ...@@ -21,7 +21,7 @@ RSpec.describe 'EE > Projects > Licenses > Maintainer views policies', :js do
context 'when policies are not configured' do context 'when policies are not configured' do
it 'displays a link to the documentation to configure license compliance' do it 'displays a link to the documentation to configure license compliance' do
expect(page).to have_content('License Compliance') expect(page).to have_content('License Compliance')
expect(page).to have_content('Learn more about license compliance') expect(page).to have_content('More Information')
end end
end end
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
exports[`DependenciesApp component on creation given the dependency list job has not yet run shows only the empty state 1`] = ` exports[`DependenciesApp component on creation given the dependency list job has not yet run shows only the empty state 1`] = `
Object { Object {
"compact": false, "compact": false,
"description": "The dependency list details information about the components used within your project.", "description": null,
"primaryButtonLink": null, "primaryButtonLink": null,
"primaryButtonText": null, "primaryButtonText": null,
"secondaryButtonLink": null, "secondaryButtonLink": null,
...@@ -17,7 +17,7 @@ Object { ...@@ -17,7 +17,7 @@ Object {
exports[`DependenciesApp component on creation given there are no dependencies detected shows only the empty state 1`] = ` exports[`DependenciesApp component on creation given there are no dependencies detected shows only the empty state 1`] = `
Object { Object {
"compact": false, "compact": false,
"description": "It seems like the Dependency Scanning job ran successfully, but no dependencies have been detected in your project.", "description": null,
"primaryButtonLink": null, "primaryButtonLink": null,
"primaryButtonText": null, "primaryButtonText": null,
"secondaryButtonLink": null, "secondaryButtonLink": null,
......
...@@ -115,6 +115,19 @@ describe('DependenciesApp component', () => { ...@@ -115,6 +115,19 @@ describe('DependenciesApp component', () => {
const expectNoDependenciesTables = () => expect(findDependenciesTables()).toHaveLength(0); const expectNoDependenciesTables = () => expect(findDependenciesTables()).toHaveLength(0);
const expectNoHeader = () => expect(findHeader().exists()).toBe(false); const expectNoHeader = () => expect(findHeader().exists()).toBe(false);
const expectEmptyStateDescription = () => {
expect(wrapper.html()).toContain(
'The dependency list details information about the components used within your project.',
);
};
const expectEmptyStateLink = () => {
const emptyStateLink = wrapper.find(GlLink);
expect(emptyStateLink.html()).toContain('More Information');
expect(emptyStateLink.attributes('href')).toBe(TEST_HOST);
expect(emptyStateLink.attributes('target')).toBe('_blank');
};
const expectDependenciesTable = () => { const expectDependenciesTable = () => {
const tables = findDependenciesTables(); const tables = findDependenciesTables();
expect(tables).toHaveLength(1); expect(tables).toHaveLength(1);
...@@ -157,6 +170,8 @@ describe('DependenciesApp component', () => { ...@@ -157,6 +170,8 @@ describe('DependenciesApp component', () => {
it('shows only the empty state', () => { it('shows only the empty state', () => {
expectComponentWithProps(GlEmptyState, { svgPath: basicAppProps.emptyStateSvgPath }); expectComponentWithProps(GlEmptyState, { svgPath: basicAppProps.emptyStateSvgPath });
expectComponentPropsToMatchSnapshot(GlEmptyState); expectComponentPropsToMatchSnapshot(GlEmptyState);
expectEmptyStateDescription();
expectEmptyStateLink();
expectNoHeader(); expectNoHeader();
expectNoDependenciesTables(); expectNoDependenciesTables();
}); });
......
...@@ -17556,9 +17556,6 @@ msgstr "" ...@@ -17556,9 +17556,6 @@ msgstr ""
msgid "Learn more about signing commits" msgid "Learn more about signing commits"
msgstr "" msgstr ""
msgid "Learn more about the dependency list"
msgstr ""
msgid "Learn more in the" msgid "Learn more in the"
msgstr "" msgstr ""
...@@ -17781,9 +17778,6 @@ msgstr "" ...@@ -17781,9 +17778,6 @@ msgstr ""
msgid "Licenses|Error fetching the license list. Please check your network connection and try again." msgid "Licenses|Error fetching the license list. Please check your network connection and try again."
msgstr "" msgstr ""
msgid "Licenses|Learn more about license compliance"
msgstr ""
msgid "Licenses|License Compliance" msgid "Licenses|License Compliance"
msgstr "" 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