Commit 4d7ca507 authored by Savas Vedova's avatar Savas Vedova

Merge branch '356279-refactor-doc-link-be' into 'master'

Refactor to load vulnerability link from backend

See merge request gitlab-org/gitlab!83648
parents 93321a59 3ace873b
...@@ -4,7 +4,6 @@ import { __, s__ } from '~/locale'; ...@@ -4,7 +4,6 @@ import { __, s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue'; import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';
import UserCalloutDismisser from '~/vue_shared/components/user_callout_dismisser.vue'; import UserCalloutDismisser from '~/vue_shared/components/user_callout_dismisser.vue';
import { helpPagePath } from '~/helpers/help_page_helper';
import AutoDevOpsAlert from './auto_dev_ops_alert.vue'; import AutoDevOpsAlert from './auto_dev_ops_alert.vue';
import AutoDevOpsEnabledAlert from './auto_dev_ops_enabled_alert.vue'; import AutoDevOpsEnabledAlert from './auto_dev_ops_enabled_alert.vue';
import { AUTO_DEVOPS_ENABLED_ALERT_DISMISSED_STORAGE_KEY } from './constants'; import { AUTO_DEVOPS_ENABLED_ALERT_DISMISSED_STORAGE_KEY } from './constants';
...@@ -52,7 +51,7 @@ export default { ...@@ -52,7 +51,7 @@ export default {
TrainingProviderList, TrainingProviderList,
}, },
mixins: [glFeatureFlagsMixin()], mixins: [glFeatureFlagsMixin()],
inject: ['projectFullPath'], inject: ['projectFullPath', 'vulnerabilityTrainingDocsPath'],
props: { props: {
augmentedSecurityFeatures: { augmentedSecurityFeatures: {
type: Array, type: Array,
...@@ -127,9 +126,6 @@ export default { ...@@ -127,9 +126,6 @@ export default {
}, },
}, },
autoDevopsEnabledAlertStorageKey: AUTO_DEVOPS_ENABLED_ALERT_DISMISSED_STORAGE_KEY, autoDevopsEnabledAlertStorageKey: AUTO_DEVOPS_ENABLED_ALERT_DISMISSED_STORAGE_KEY,
securityTraininDocLink: helpPagePath('user/application_security/vulnerabilities/index', {
anchor: 'enable-security-training-for-vulnerabilities',
}),
}; };
</script> </script>
...@@ -268,7 +264,7 @@ export default { ...@@ -268,7 +264,7 @@ export default {
{{ $options.i18n.securityTrainingDescription }} {{ $options.i18n.securityTrainingDescription }}
</p> </p>
<p> <p>
<gl-link :href="$options.securityTraininDocLink">{{ <gl-link :href="vulnerabilityTrainingDocsPath">{{
$options.i18n.securityTrainingDoc $options.i18n.securityTrainingDoc
}}</gl-link> }}</gl-link>
</p> </p>
......
...@@ -25,6 +25,7 @@ export const initSecurityConfiguration = (el) => { ...@@ -25,6 +25,7 @@ export const initSecurityConfiguration = (el) => {
gitlabCiHistoryPath, gitlabCiHistoryPath,
autoDevopsHelpPagePath, autoDevopsHelpPagePath,
autoDevopsPath, autoDevopsPath,
vulnerabilityTrainingDocsPath,
} = el.dataset; } = el.dataset;
const { augmentedSecurityFeatures, augmentedComplianceFeatures } = augmentFeatures( const { augmentedSecurityFeatures, augmentedComplianceFeatures } = augmentFeatures(
...@@ -41,6 +42,7 @@ export const initSecurityConfiguration = (el) => { ...@@ -41,6 +42,7 @@ export const initSecurityConfiguration = (el) => {
upgradePath, upgradePath,
autoDevopsHelpPagePath, autoDevopsHelpPagePath,
autoDevopsPath, autoDevopsPath,
vulnerabilityTrainingDocsPath,
}, },
render(createElement) { render(createElement) {
return createElement(SecurityConfigurationApp, { return createElement(SecurityConfigurationApp, {
......
...@@ -6,6 +6,10 @@ module Projects ...@@ -6,6 +6,10 @@ module Projects
def security_upgrade_path def security_upgrade_path
"https://#{ApplicationHelper.promo_host}/pricing/" "https://#{ApplicationHelper.promo_host}/pricing/"
end end
def vulnerability_training_docs_path
help_page_path('user/application_security/vulnerabilities/index', anchor: 'enable-security-training-for-vulnerabilities')
end
end end
end end
end end
......
...@@ -3,5 +3,6 @@ ...@@ -3,5 +3,6 @@
- @content_class = "limit-container-width" unless fluid_layout - @content_class = "limit-container-width" unless fluid_layout
#js-security-configuration{ data: { **@configuration.to_html_data_attribute, #js-security-configuration{ data: { **@configuration.to_html_data_attribute,
vulnerability_training_docs_path: vulnerability_training_docs_path,
upgrade_path: security_upgrade_path, upgrade_path: security_upgrade_path,
project_full_path: @project.full_path } } project_full_path: @project.full_path } }
...@@ -3,5 +3,6 @@ ...@@ -3,5 +3,6 @@
- @content_class = "limit-container-width" unless fluid_layout - @content_class = "limit-container-width" unless fluid_layout
#js-security-configuration{ data: { **@configuration.to_html_data_attribute, #js-security-configuration{ data: { **@configuration.to_html_data_attribute,
vulnerability_training_docs_path: vulnerability_training_docs_path,
upgrade_path: security_upgrade_path, upgrade_path: security_upgrade_path,
project_full_path: @project.full_path } } project_full_path: @project.full_path } }
...@@ -33,6 +33,7 @@ const autoDevopsHelpPagePath = '/autoDevopsHelpPagePath'; ...@@ -33,6 +33,7 @@ const autoDevopsHelpPagePath = '/autoDevopsHelpPagePath';
const autoDevopsPath = '/autoDevopsPath'; const autoDevopsPath = '/autoDevopsPath';
const gitlabCiHistoryPath = 'test/historyPath'; const gitlabCiHistoryPath = 'test/historyPath';
const projectFullPath = 'namespace/project'; const projectFullPath = 'namespace/project';
const vulnerabilityTrainingDocsPath = 'user/application_security/vulnerabilities/index';
useLocalStorageSpy(); useLocalStorageSpy();
...@@ -55,6 +56,7 @@ describe('App component', () => { ...@@ -55,6 +56,7 @@ describe('App component', () => {
autoDevopsHelpPagePath, autoDevopsHelpPagePath,
autoDevopsPath, autoDevopsPath,
projectFullPath, projectFullPath,
vulnerabilityTrainingDocsPath,
glFeatures: { glFeatures: {
secureVulnerabilityTraining, secureVulnerabilityTraining,
}, },
...@@ -462,9 +464,7 @@ describe('App component', () => { ...@@ -462,9 +464,7 @@ describe('App component', () => {
const trainingLink = findVulnerabilityManagementTab().findComponent(GlLink); const trainingLink = findVulnerabilityManagementTab().findComponent(GlLink);
expect(trainingLink.text()).toBe('Learn more about vulnerability training'); expect(trainingLink.text()).toBe('Learn more about vulnerability training');
expect(trainingLink.attributes('href')).toBe( expect(trainingLink.attributes('href')).toBe(vulnerabilityTrainingDocsPath);
'/help/user/application_security/vulnerabilities/index#enable-security-training-for-vulnerabilities',
);
}); });
}); });
......
...@@ -10,4 +10,10 @@ RSpec.describe Projects::Security::ConfigurationHelper do ...@@ -10,4 +10,10 @@ RSpec.describe Projects::Security::ConfigurationHelper do
it { is_expected.to eq("https://#{ApplicationHelper.promo_host}/pricing/") } it { is_expected.to eq("https://#{ApplicationHelper.promo_host}/pricing/") }
end end
describe 'vulnerability_training_docs_path' do
subject { helper.vulnerability_training_docs_path }
it { is_expected.to eq(help_page_path('user/application_security/vulnerabilities/index', anchor: 'enable-security-training-for-vulnerabilities')) }
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