Commit 3101bc43 authored by Dheeraj Joshi's avatar Dheeraj Joshi Committed by Kushal Pandya

Add a tooltip for showing Dependency Paths

This adds a tooltip in Dependency List
parent 1ed54ff5
...@@ -4,10 +4,13 @@ import { ...@@ -4,10 +4,13 @@ import {
GlBadge, GlBadge,
GlIcon, GlIcon,
GlButton, GlButton,
GlDeprecatedSkeletonLoading as GlSkeletonLoading, GlSkeletonLoader,
GlTable, GlTable,
GlPopover,
GlLink,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import DependencyLicenseLinks from './dependency_license_links.vue'; import DependencyLicenseLinks from './dependency_license_links.vue';
import DependencyVulnerabilities from './dependency_vulnerabilities.vue'; import DependencyVulnerabilities from './dependency_vulnerabilities.vue';
import DependencyLocation from './dependency_location.vue'; import DependencyLocation from './dependency_location.vue';
...@@ -37,9 +40,12 @@ export default { ...@@ -37,9 +40,12 @@ export default {
GlBadge, GlBadge,
GlIcon, GlIcon,
GlButton, GlButton,
GlSkeletonLoading, GlSkeletonLoader,
GlTable, GlTable,
GlPopover,
GlLink,
}, },
mixins: [glFeatureFlagsMixin()],
props: { props: {
dependencies: { dependencies: {
type: Array, type: Array,
...@@ -87,6 +93,14 @@ export default { ...@@ -87,6 +93,14 @@ export default {
{ key: 'isVulnerable', label: '', tdClass }, { key: 'isVulnerable', label: '', tdClass },
], ],
DEPENDENCIES_PER_PAGE: 20, DEPENDENCIES_PER_PAGE: 20,
DEPENDENCY_PATH_LINK:
'https://docs.gitlab.com/ee/user/application_security/dependency_list/#dependency-paths',
i18n: {
tooltipText: s__(
'Dependencies|The component dependency path is based on the lock file. There may be several paths. In these cases, the longest path is displayed.',
),
tooltipMoreText: s__('Dependencies|Learn more about dependency paths'),
},
}; };
</script> </script>
...@@ -99,6 +113,29 @@ export default { ...@@ -99,6 +113,29 @@ export default {
details-td-class="pt-0" details-td-class="pt-0"
stacked="md" stacked="md"
> >
<template #head(location)="data">
{{ data.label }}
<template v-if="glFeatures.pathToVulnerableDependency">
<gl-icon id="location-info" name="information" class="gl-text-blue-600" />
<gl-popover
target="location-info"
triggers="hover focus"
placement="top"
:title="s__('Dependencies|Location and dependency path')"
>
{{ $options.i18n.tooltipText }}
<div class="gl-mt-4">
<gl-link
:href="$options.DEPENDENCY_PATH_LINK"
target="_blank"
class="font-size-inherit"
>{{ $options.i18n.tooltipMoreText }}</gl-link
>
</div>
</gl-popover>
</template>
</template>
<!-- toggleDetails and detailsShowing are scoped slot props provided by <!-- toggleDetails and detailsShowing are scoped slot props provided by
GlTable; they mutate/read the item's _showDetails property, which GlTable GlTable; they mutate/read the item's _showDetails property, which GlTable
uses to show/hide the row-details slot --> uses to show/hide the row-details slot -->
...@@ -152,7 +189,7 @@ export default { ...@@ -152,7 +189,7 @@ export default {
<template #table-busy> <template #table-busy>
<div class="mt-2"> <div class="mt-2">
<gl-skeleton-loading v-for="n in $options.DEPENDENCIES_PER_PAGE" :key="n" :lines="1" /> <gl-skeleton-loader v-for="n in $options.DEPENDENCIES_PER_PAGE" :key="n" :lines="1" />
</div> </div>
</template> </template>
</gl-table> </gl-table>
......
import { nextTick } from 'vue'; import { nextTick } from 'vue';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { import { GlBadge, GlButton, GlLink, GlSkeletonLoader } from '@gitlab/ui';
GlBadge,
GlButton,
GlLink,
GlDeprecatedSkeletonLoading as GlSkeletonLoading,
} from '@gitlab/ui';
import stubChildren from 'helpers/stub_children'; import stubChildren from 'helpers/stub_children';
import DependenciesTable from 'ee/dependencies/components/dependencies_table.vue'; import DependenciesTable from 'ee/dependencies/components/dependencies_table.vue';
import DependencyLicenseLinks from 'ee/dependencies/components/dependency_license_links.vue'; import DependencyLicenseLinks from 'ee/dependencies/components/dependency_license_links.vue';
...@@ -80,7 +75,7 @@ describe('DependenciesTable component', () => { ...@@ -80,7 +75,7 @@ describe('DependenciesTable component', () => {
}); });
it('renders the loading skeleton', () => { it('renders the loading skeleton', () => {
expect(wrapper.find(GlSkeletonLoading).exists()).toBe(true); expect(wrapper.find(GlSkeletonLoader).exists()).toBe(true);
}); });
it('does not render any dependencies', () => { it('does not render any dependencies', () => {
......
...@@ -8610,18 +8610,27 @@ msgstr "" ...@@ -8610,18 +8610,27 @@ msgstr ""
msgid "Dependencies|Job failed to generate the dependency list" msgid "Dependencies|Job failed to generate the dependency list"
msgstr "" msgstr ""
msgid "Dependencies|Learn more about dependency paths"
msgstr ""
msgid "Dependencies|License" msgid "Dependencies|License"
msgstr "" msgstr ""
msgid "Dependencies|Location" msgid "Dependencies|Location"
msgstr "" msgstr ""
msgid "Dependencies|Location and dependency path"
msgstr ""
msgid "Dependencies|Packager" msgid "Dependencies|Packager"
msgstr "" msgstr ""
msgid "Dependencies|The %{codeStartTag}dependency_scanning%{codeEndTag} job has failed and cannot generate the list. Please ensure the job is running properly and run the pipeline again." msgid "Dependencies|The %{codeStartTag}dependency_scanning%{codeEndTag} job has failed and cannot generate the list. Please ensure the job is running properly and run the pipeline again."
msgstr "" msgstr ""
msgid "Dependencies|The component dependency path is based on the lock file. There may be several paths. In these cases, the longest path is displayed."
msgstr ""
msgid "Dependencies|There may be multiple paths" msgid "Dependencies|There may be multiple paths"
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