Commit 26a1fed5 authored by Dave Pisek's avatar Dave Pisek

Final polish before review

* Move strings to $options.i18n
* Renaming
* Misc
parent c2ac9042
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
}, },
mixins: [glFeatureFlagMixin()], mixins: [glFeatureFlagMixin()],
props: { props: {
newProfilePaths: { createNewProfilePaths: {
type: Object, type: Object,
required: true, required: true,
validator: ({ scannerProfile, siteProfile }) => validator: ({ scannerProfile, siteProfile }) =>
...@@ -67,11 +67,11 @@ export default { ...@@ -67,11 +67,11 @@ export default {
}, },
computed: { computed: {
profileSettings() { profileSettings() {
const { glFeatures, newProfilePaths } = this; const { glFeatures, createNewProfilePaths } = this;
return getProfileSettings({ return getProfileSettings({
glFeatures, glFeatures,
options: { newProfilePaths }, options: { createNewProfilePaths },
}); });
}, },
hasMoreSiteProfiles() { hasMoreSiteProfiles() {
...@@ -166,6 +166,11 @@ export default { ...@@ -166,6 +166,11 @@ export default {
}, },
profilesPerPage: 10, profilesPerPage: 10,
i18n: { i18n: {
heading: s__('DastProfiles|Manage Profiles'),
newProfileDropdownLabel: s__('DastProfiles|New Profile'),
subHeading: s__(
'DastProfiles|Save commonly used configurations for target sites and scan specifications as profiles. Use these with an on-demand scan.',
),
errorMessages: { errorMessages: {
fetchNetworkError: s__( fetchNetworkError: s__(
'DastProfiles|Could not fetch site profiles. Please refresh the page, or try again later.', 'DastProfiles|Could not fetch site profiles. Please refresh the page, or try again later.',
...@@ -184,29 +189,25 @@ export default { ...@@ -184,29 +189,25 @@ export default {
<header> <header>
<div class="gl-display-flex gl-align-items-center gl-pt-6 gl-pb-4"> <div class="gl-display-flex gl-align-items-center gl-pt-6 gl-pb-4">
<h2 class="my-0"> <h2 class="my-0">
{{ s__('DastProfiles|Manage Profiles') }} {{ $options.i18n.heading }}
</h2> </h2>
<gl-dropdown <gl-dropdown
:text="s__('DastProfiles|New Profile')" :text="$options.i18n.newProfileDropdownLabel"
right
variant="success" variant="success"
right
class="gl-ml-auto" class="gl-ml-auto"
> >
<gl-dropdown-item <gl-dropdown-item
v-for="{ i18n, newProfilePath, key } in profileSettings" v-for="{ i18n, createNewProfilePath, key } in profileSettings"
:key="key" :key="key"
:href="newProfilePath" :href="createNewProfilePath"
> >
{{ i18n.title }} {{ i18n.title }}
</gl-dropdown-item> </gl-dropdown-item>
</gl-dropdown> </gl-dropdown>
</div> </div>
<p> <p>
{{ {{ $options.i18n.subHeading }}
s__(
'DastProfiles|Save commonly used configurations for target sites and scan specifications as profiles. Use these with an on-demand scan.',
)
}}
</p> </p>
</header> </header>
......
...@@ -14,7 +14,7 @@ export default () => { ...@@ -14,7 +14,7 @@ export default () => {
} = el; } = el;
const props = { const props = {
newProfilePaths: { createNewProfilePaths: {
scannerProfile: newDastScannerProfilePath, scannerProfile: newDastScannerProfilePath,
siteProfile: newDastSiteProfilePath, siteProfile: newDastSiteProfilePath,
}, },
......
...@@ -5,21 +5,21 @@ const hasNoFeatureFlagOrEnabled = glFeatures => ([, { featureFlag }]) => { ...@@ -5,21 +5,21 @@ const hasNoFeatureFlagOrEnabled = glFeatures => ([, { featureFlag }]) => {
return true; return true;
} }
return glFeatures[featureFlag]; return Boolean(glFeatures[featureFlag]);
}; };
export default function({ glFeatures, options: { newProfilePaths } = {} }) { export default function({ glFeatures, options: { createNewProfilePaths } = {} }) {
const settings = { const settings = {
siteProfiles: { siteProfiles: {
key: 'siteProfiles', key: 'siteProfiles',
newProfilePath: newProfilePaths.siteProfile, createNewProfilePath: createNewProfilePaths.siteProfile,
i18n: { i18n: {
title: s__('DastProfiles|Site Profile'), title: s__('DastProfiles|Site Profile'),
}, },
}, },
scannerProfiles: { scannerProfiles: {
key: 'scannerProfiles', key: 'scannerProfiles',
newProfilePath: newProfilePaths.scannerProfile, createNewProfilePath: createNewProfilePaths.scannerProfile,
featureFlag: 'securityOnDemandScansScannerProfiles', featureFlag: 'securityOnDemandScansScannerProfiles',
i18n: { i18n: {
title: s__('DastProfiles|Scanner Profile'), title: s__('DastProfiles|Scanner Profile'),
......
...@@ -14,7 +14,7 @@ describe('EE - DastProfiles', () => { ...@@ -14,7 +14,7 @@ describe('EE - DastProfiles', () => {
const createComponentFactory = (mountFn = shallowMount) => (options = {}) => { const createComponentFactory = (mountFn = shallowMount) => (options = {}) => {
const defaultProps = { const defaultProps = {
newProfilePaths: { createNewProfilePaths: {
scannerProfile: TEST_NEW_DAST_SCANNER_PROFILE_PATH, scannerProfile: TEST_NEW_DAST_SCANNER_PROFILE_PATH,
siteProfile: TEST_NEW_DAST_SITE_PROFILE_PATH, siteProfile: TEST_NEW_DAST_SITE_PROFILE_PATH,
}, },
......
...@@ -16,6 +16,10 @@ RSpec.describe "projects/dast_profiles/index", type: :view do ...@@ -16,6 +16,10 @@ RSpec.describe "projects/dast_profiles/index", type: :view do
expect(rendered).to include '/on_demand_scans/profiles/dast_site_profiles/new' expect(rendered).to include '/on_demand_scans/profiles/dast_site_profiles/new'
end end
it 'passes new dast scanner profile path' do
expect(rendered).to include '/on_demand_scans/profiles/dast_scanner_profiles/new'
end
it 'passes project\'s full path' do it 'passes project\'s full path' do
expect(rendered).to include @project.path_with_namespace expect(rendered).to include @project.path_with_namespace
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