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