Commit 16e54231 authored by Dave Pisek's avatar Dave Pisek

Reviewer feedback: profile settings, changelog

* Small refactor on profile settings function params and export
* Adds changelog entry
* Changes create-new profile paths to be without namespaces
* Changes `withFeatureFlag` helper to use `it`
parent 26a1fed5
...@@ -7,7 +7,7 @@ import ProfilesList from './dast_profiles_list.vue'; ...@@ -7,7 +7,7 @@ import ProfilesList from './dast_profiles_list.vue';
import dastSiteProfilesQuery from '../graphql/dast_site_profiles.query.graphql'; import dastSiteProfilesQuery from '../graphql/dast_site_profiles.query.graphql';
import dastSiteProfilesDelete from '../graphql/dast_site_profiles_delete.mutation.graphql'; import dastSiteProfilesDelete from '../graphql/dast_site_profiles_delete.mutation.graphql';
import * as cacheUtils from '../graphql/cache_utils'; import * as cacheUtils from '../graphql/cache_utils';
import getProfileSettings from '../settings/profiles'; import { getProfileSettings } from '../settings/profiles';
export default { export default {
components: { components: {
...@@ -69,10 +69,12 @@ export default { ...@@ -69,10 +69,12 @@ export default {
profileSettings() { profileSettings() {
const { glFeatures, createNewProfilePaths } = this; const { glFeatures, createNewProfilePaths } = this;
return getProfileSettings({ return getProfileSettings(
{
createNewProfilePaths,
},
glFeatures, glFeatures,
options: { createNewProfilePaths }, );
});
}, },
hasMoreSiteProfiles() { hasMoreSiteProfiles() {
return this.siteProfilesPageInfo.hasNextPage; return this.siteProfilesPageInfo.hasNextPage;
......
import { s__ } from '~/locale'; import { s__ } from '~/locale';
const hasNoFeatureFlagOrEnabled = glFeatures => ([, { featureFlag }]) => { const hasNoFeatureFlagOrIsEnabled = glFeatures => ([, { featureFlag }]) => {
if (!featureFlag) { if (!featureFlag) {
return true; return true;
} }
...@@ -8,7 +8,7 @@ const hasNoFeatureFlagOrEnabled = glFeatures => ([, { featureFlag }]) => { ...@@ -8,7 +8,7 @@ const hasNoFeatureFlagOrEnabled = glFeatures => ([, { featureFlag }]) => {
return Boolean(glFeatures[featureFlag]); return Boolean(glFeatures[featureFlag]);
}; };
export default function({ glFeatures, options: { createNewProfilePaths } = {} }) { export const getProfileSettings = ({ createNewProfilePaths }, glFeatures) => {
const settings = { const settings = {
siteProfiles: { siteProfiles: {
key: 'siteProfiles', key: 'siteProfiles',
...@@ -27,5 +27,7 @@ export default function({ glFeatures, options: { createNewProfilePaths } = {} }) ...@@ -27,5 +27,7 @@ export default function({ glFeatures, options: { createNewProfilePaths } = {} })
}, },
}; };
return Object.fromEntries(Object.entries(settings).filter(hasNoFeatureFlagOrEnabled(glFeatures))); return Object.fromEntries(
} Object.entries(settings).filter(hasNoFeatureFlagOrIsEnabled(glFeatures)),
);
};
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
- breadcrumb_title s_('DastProfiles|Manage profiles') - breadcrumb_title s_('DastProfiles|Manage profiles')
- page_title s_('DastProfiles|Manage profiles') - page_title s_('DastProfiles|Manage profiles')
.js-dast-profiles{ data: { new_dast_site_profile_path: new_namespace_project_dast_site_profile_path(namespace_id: @project.namespace, project_id: @project.path), .js-dast-profiles{ data: { new_dast_site_profile_path: new_project_dast_site_profile_path(@project),
new_dast_scanner_profile_path: new_namespace_project_dast_scanner_profile_path(namespace_id: @project.namespace, project_id: @project.path), new_dast_scanner_profile_path: new_project_dast_scanner_profile_path(@project),
project_full_path: @project.path_with_namespace } } project_full_path: @project.path_with_namespace } }
---
title: 'DAST Scanner Profile Library: change new-profile button to dropdown'
merge_request: 40469
author:
type: changed
...@@ -49,7 +49,7 @@ describe('EE - DastProfiles', () => { ...@@ -49,7 +49,7 @@ describe('EE - DastProfiles', () => {
const createFullComponent = createComponentFactory(mount); const createFullComponent = createComponentFactory(mount);
const withFeatureFlag = (featureFlagName, { enabled, disabled }) => { const withFeatureFlag = (featureFlagName, { enabled, disabled }) => {
describe.each([true, false])(`with ${featureFlagName} enabled: "%s"`, featureFlagStatus => { it.each([true, false])(`with ${featureFlagName} enabled: "%s"`, featureFlagStatus => {
createComponent({ createComponent({
provide: { provide: {
glFeatures: { glFeatures: {
......
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