Skip to content
Snippets Groups Projects
Commit 29d966a0 authored by Dheeraj Joshi's avatar Dheeraj Joshi
Browse files

Remove dast_ui_redesign feature flag

This removes `dast_ui_redesign` feature flag.

This also cleanup code related to previous component.

EE: true
Changelog: removed
parent cb4c7c1c
No related merge requests found
......@@ -23,7 +23,6 @@ import { redirectTo, queryToObject } from '~/lib/utils/url_utility';
import { s__, __ } from '~/locale';
import RefSelector from '~/ref/components/ref_selector.vue';
import { REF_TYPE_BRANCHES } from '~/ref/constants';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';
import validation from '~/vue_shared/directives/validation';
import {
......@@ -37,46 +36,12 @@ import ConfigurationPageLayout from 'ee/security_configuration/components/config
import DastProfilesConfigurator from 'ee/security_configuration/dast_profiles/dast_profiles_configurator/dast_profiles_configurator.vue';
import dastProfileCreateMutation from '../graphql/dast_profile_create.mutation.graphql';
import dastProfileUpdateMutation from '../graphql/dast_profile_update.mutation.graphql';
import {
ERROR_RUN_SCAN,
ERROR_FETCH_SCANNER_PROFILES,
ERROR_FETCH_SITE_PROFILES,
ERROR_MESSAGES,
SCANNER_PROFILES_QUERY,
SITE_PROFILES_QUERY,
} from '../settings';
import { ERROR_RUN_SCAN } from '../settings';
import ProfileConflictAlert from './profile_selector/profile_conflict_alert.vue';
import ScannerProfileSelector from './profile_selector/scanner_profile_selector.vue';
import SiteProfileSelector from './profile_selector/site_profile_selector.vue';
import ScanSchedule from './scan_schedule.vue';
export const ON_DEMAND_SCANS_STORAGE_KEY = 'on-demand-scans-new-form';
/**
* TODO Can be removed after rolling out
* dastUiRedesign feature flag
* Content was transferred to DastProfilesConfigurator
*/
const createProfilesApolloOptions = (name, field, { fetchQuery, fetchError }) => ({
query: fetchQuery,
variables() {
return {
fullPath: this.projectPath,
};
},
update(data) {
const nodes = data?.project?.[name]?.nodes ?? [];
if (nodes.length === 1) {
this[field] = nodes[0].id;
}
return nodes;
},
error(e) {
Sentry.captureException(e);
this.showErrors(fetchError);
},
});
export default {
enabledRefTypes: [REF_TYPE_BRANCHES],
saveAndRunScanBtnId: 'scan-submit-button',
......@@ -133,8 +98,6 @@ export default {
components: {
RefSelector,
ProfileConflictAlert,
ScannerProfileSelector,
SiteProfileSelector,
ScanSchedule,
GlAlert,
GlButton,
......@@ -155,24 +118,6 @@ export default {
SafeHtml: GlSafeHtmlDirective,
validation: validation(),
},
mixins: [glFeatureFlagMixin()],
/**
* TODO Can be removed after rolling out
* dastUiRedesign feature flag
* Content was transferred to DastProfilesConfigurator
*/
apollo: {
scannerProfiles: createProfilesApolloOptions(
'scannerProfiles',
'selectedScannerProfileId',
SCANNER_PROFILES_QUERY,
),
siteProfiles: createProfilesApolloOptions(
'siteProfiles',
'selectedSiteProfileId',
SITE_PROFILES_QUERY,
),
},
inject: ['projectPath', 'onDemandScansPath'],
props: {
defaultBranch: {
......@@ -214,9 +159,6 @@ export default {
};
},
computed: {
/**
* TODO remove after dastUiRedesign flag roll out
*/
dastScanId() {
return this.dastScan?.id ?? null;
},
......@@ -239,15 +181,7 @@ export default {
: null;
},
errorMessage() {
return this.glFeatures.dastUiRedesign
? this.errorType
: ERROR_MESSAGES[this.errorType] || null;
},
isLoadingProfiles() {
return ['scannerProfiles', 'siteProfiles'].some((name) => this.$apollo.queries[name].loading);
},
failedToLoadProfiles() {
return [ERROR_FETCH_SCANNER_PROFILES, ERROR_FETCH_SITE_PROFILES].includes(this.errorType);
return this.errorType;
},
someFieldEmpty() {
const { selectedScannerProfile, selectedSiteProfile } = this;
......@@ -426,7 +360,6 @@ export default {
variant="danger"
class="gl-mb-5"
data-testid="on-demand-scan-error"
:dismissible="!failedToLoadProfiles"
@dismiss="hideErrors"
>
{{ errorMessage }}
......@@ -434,11 +367,7 @@ export default {
<li v-for="error in errors" :key="error" v-safe-html="error"></li>
</ul>
</gl-alert>
<section-layout
v-if="!failedToLoadProfiles"
:heading="$options.i18n.scanConfigurationHeader"
:is-loading="isLoadingProfiles"
>
<section-layout :heading="$options.i18n.scanConfigurationHeader">
<template #description>
<p>{{ $options.i18n.scanConfigurationDescription }}</p>
</template>
......@@ -502,53 +431,13 @@ export default {
</section-layout>
<dast-profiles-configurator
v-if="glFeatures.dastUiRedesign"
:saved-profiles="dastScan"
:full-path="projectPath"
@error="showErrors"
@profiles-selected="selectProfiles"
/>
<section-layout
v-if="!failedToLoadProfiles && !glFeatures.dastUiRedesign"
:heading="$options.i18n.dastConfigurationHeader"
:is-loading="isLoadingProfiles"
>
<template #description>
<p>
<gl-sprintf :message="$options.i18n.dastConfigurationDescription">
<template #link="{ content }">
<gl-link :href="$options.dastConfigurationHelpPath">{{ content }}</gl-link>
</template>
</gl-sprintf>
</p>
</template>
<template #features>
<scanner-profile-selector
v-model="selectedScannerProfileId"
class="gl-mb-6"
:profiles="scannerProfiles"
:selected-profile="selectedScannerProfile"
:has-conflict="hasProfilesConflict"
:dast-scan-id="dastScanId"
/>
<site-profile-selector
v-model="selectedSiteProfileId"
class="gl-mb-2"
:profiles="siteProfiles"
:selected-profile="selectedSiteProfile"
:has-conflict="hasProfilesConflict"
:dast-scan-id="dastScanId"
/>
</template>
</section-layout>
<section-layout
v-if="!failedToLoadProfiles"
:heading="$options.i18n.scanScheduleHeader"
:is-loading="isLoadingProfiles"
>
<section-layout :heading="$options.i18n.scanScheduleHeader">
<template #description>
<p>{{ $options.i18n.scanScheduleDescription }}</p>
</template>
......@@ -557,42 +446,40 @@ export default {
</template>
</section-layout>
<div v-if="!failedToLoadProfiles">
<profile-conflict-alert
v-if="hasProfilesConflict"
class="gl-mt-6"
data-testid="on-demand-scans-profiles-conflict-alert"
/>
<profile-conflict-alert
v-if="hasProfilesConflict"
class="gl-mt-6"
data-testid="on-demand-scans-profiles-conflict-alert"
/>
<div class="gl-pt-6">
<gl-button
type="submit"
variant="confirm"
class="js-no-auto-disable"
data-testid="on-demand-scan-submit-button"
:disabled="isSubmitButtonDisabled"
:loading="loading === $options.saveAndRunScanBtnId"
>
{{ $options.i18n.saveAndRunScanButton }}
</gl-button>
<gl-button
variant="confirm"
category="secondary"
data-testid="on-demand-scan-save-button"
:disabled="isSaveButtonDisabled"
:loading="loading === $options.saveScanBtnId"
@click="onSubmit({ runAfter: false, button: $options.saveScanBtnId })"
>
{{ $options.i18n.saveScanButton }}
</gl-button>
<gl-button
data-testid="on-demand-scan-cancel-button"
:disabled="Boolean(loading)"
@click="onCancelClicked"
>
{{ $options.i18n.cancelButton }}
</gl-button>
</div>
<div class="gl-pt-6">
<gl-button
type="submit"
variant="confirm"
class="js-no-auto-disable"
data-testid="on-demand-scan-submit-button"
:disabled="isSubmitButtonDisabled"
:loading="loading === $options.saveAndRunScanBtnId"
>
{{ $options.i18n.saveAndRunScanButton }}
</gl-button>
<gl-button
variant="confirm"
category="secondary"
data-testid="on-demand-scan-save-button"
:disabled="isSaveButtonDisabled"
:loading="loading === $options.saveScanBtnId"
@click="onSubmit({ runAfter: false, button: $options.saveScanBtnId })"
>
{{ $options.i18n.saveScanButton }}
</gl-button>
<gl-button
data-testid="on-demand-scan-cancel-button"
:disabled="Boolean(loading)"
@click="onCancelClicked"
>
{{ $options.i18n.cancelButton }}
</gl-button>
</div>
</gl-form>
</configuration-page-layout>
......
<script>
import { GlLink, GlSprintf, GlButton, GlForm, GlAlert } from '@gitlab/ui';
import DastProfilesSelector from 'ee/on_demand_scans_form/components/profile_selector/dast_profiles_selector.vue';
import DastProfilesConfigurator from 'ee/security_configuration/dast_profiles/dast_profiles_configurator/dast_profiles_configurator.vue';
import ConfigurationSnippetModal from 'ee/security_configuration/components/configuration_snippet_modal.vue';
import { CONFIGURATION_SNIPPET_MODAL_ID } from 'ee/security_configuration/components/constants';
......@@ -26,7 +25,6 @@ export default {
GlForm,
GlAlert,
ConfigurationSnippetModal,
DastProfilesSelector,
DastProfilesConfigurator,
},
mixins: [glFeatureFlagMixin()],
......@@ -84,7 +82,6 @@ export default {
<template>
<gl-form @submit.prevent="onSubmit">
<dast-profiles-configurator
v-if="glFeatures.dastUiRedesign"
:configuration-header="$options.i18n.dastConfigurationHeader"
class="gl-mb-6"
:full-path="projectPath"
......@@ -102,16 +99,6 @@ export default {
</template>
</dast-profiles-configurator>
<section v-if="!glFeatures.dastUiRedesign" class="gl-mt-5">
<p>
<gl-sprintf :message="$options.i18n.helpText">
<template #docsLink="{ content }">
<gl-link :href="$options.DAST_HELP_PATH" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
</p>
</section>
<gl-alert
v-if="showAlert"
variant="danger"
......@@ -122,13 +109,6 @@ export default {
{{ errorMessage }}
</gl-alert>
<dast-profiles-selector
v-if="!glFeatures.dastUiRedesign"
@profiles-selected="updateProfiles"
@error="showErrors"
@profiles-has-conflict="hasProfilesConflict = $event"
/>
<gl-button
:disabled="isSubmitDisabled"
:loading="isLoading"
......
......@@ -7,9 +7,6 @@ class OnDemandScansController < Projects::ApplicationController
before_action :authorize_read_on_demand_dast_scan!, only: :index
before_action :authorize_create_on_demand_dast_scan!, only: [:new, :edit]
before_action do
push_frontend_feature_flag(:dast_ui_redesign, @project)
end
feature_category :dynamic_application_security_testing
......
......@@ -8,10 +8,6 @@ class DastConfigurationController < Projects::ApplicationController
alias_method :vulnerable, :project
before_action do
push_frontend_feature_flag(:dast_ui_redesign, @project)
end
feature_category :dynamic_application_security_testing
def show
......
---
name: dast_ui_redesign
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/86165
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/360820
milestone: '15.0'
type: development
group: group::dynamic analysis
default_enabled: true
......@@ -6,8 +6,6 @@ import { nextTick } from 'vue';
import siteProfilesFixtures from 'test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_site_profiles.query.graphql.basic.json';
import scannerProfilesFixtures from 'test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_scanner_profiles.query.graphql.basic.json';
import OnDemandScansForm from 'ee/on_demand_scans_form/components/on_demand_scans_form.vue';
import ScannerProfileSelector from 'ee/on_demand_scans_form/components/profile_selector/scanner_profile_selector.vue';
import SiteProfileSelector from 'ee/on_demand_scans_form/components/profile_selector/site_profile_selector.vue';
import ScanSchedule from 'ee/on_demand_scans_form/components/scan_schedule.vue';
import ConfigurationPageLayout from 'ee/security_configuration/components/configuration_page_layout.vue';
import SectionLayout from '~/vue_shared/security_configuration/components/section_layout.vue';
......@@ -82,8 +80,6 @@ describe('OnDemandScansForm', () => {
const findNameInput = () => findByTestId('dast-scan-name-input');
const findBranchInput = () => findByTestId('dast-scan-branch-input');
const findDescriptionInput = () => findByTestId('dast-scan-description-input');
const findScannerProfilesSelector = () => wrapper.findComponent(ScannerProfileSelector);
const findSiteProfilesSelector = () => wrapper.findComponent(SiteProfileSelector);
const findAlert = () => findByTestId('on-demand-scan-error');
const findProfilesConflictAlert = () => findByTestId('on-demand-scans-profiles-conflict-alert');
const findSubmitButton = () => findByTestId('on-demand-scan-submit-button');
......@@ -92,16 +88,9 @@ describe('OnDemandScansForm', () => {
const findProfileSummary = () => findByTestId('selected-profile-summary');
const findDastProfilesConfigurator = () => wrapper.find(DastProfilesConfigurator);
const hasSiteProfileAttributes = () => {
expect(findScannerProfilesSelector().attributes('value')).toBe(dastScan.dastScannerProfile.id);
expect(findSiteProfilesSelector().attributes('value')).toBe(dastScan.dastSiteProfile.id);
};
const setValidFormData = async () => {
findNameInput().vm.$emit('input', 'My daily scan');
findBranchInput().vm.$emit('input', selectedBranch);
findScannerProfilesSelector().vm.$emit('input', passiveScannerProfile.id);
findSiteProfilesSelector().vm.$emit('input', nonValidatedSiteProfile.id);
await nextTick();
};
......@@ -229,6 +218,10 @@ describe('OnDemandScansForm', () => {
expect(wrapper.text()).toContain('New on-demand scan');
expect(wrapper.findComponent(ScanSchedule).exists()).toBe(true);
expect(findDastProfilesConfigurator().exists()).toBe(true);
expect(findScannerProfilesSelector().exists()).toBe(false);
expect(findSiteProfilesSelector().exists()).toBe(false);
});
it('renders a link to the docs', () => {
......@@ -682,36 +675,4 @@ describe('OnDemandScansForm', () => {
);
});
});
describe('With `dastUiRedesign` feature flag on', () => {
beforeEach(() => {
createShallowComponent({}, false, {
glFeatures: {
dastUiRedesign: true,
},
});
});
it('should have correct component rendered', async () => {
expect(findDastProfilesConfigurator().exists()).toBe(true);
expect(findScannerProfilesSelector().exists()).toBe(false);
expect(findSiteProfilesSelector().exists()).toBe(false);
});
});
describe('With `dastUiRedesign` feature flag off', () => {
beforeEach(() => {
createShallowComponent({}, false, {
glFeatures: {
dastUiRedesign: false,
},
});
});
it('should have correct component rendered', async () => {
expect(findDastProfilesConfigurator().exists()).toBe(false);
expect(findScannerProfilesSelector().exists()).toBe(true);
expect(findSiteProfilesSelector().exists()).toBe(true);
});
});
});
......@@ -48,14 +48,7 @@ describe('EE - DAST Configuration Form', () => {
const findDastProfilesSelector = () => wrapper.findComponent(DastProfilesSelector);
const findAlert = () => wrapper.findByTestId('dast-configuration-error');
const createComponentFactory = (mountFn = shallowMount) => (
options = {},
glFeatures = {
glFeatures: {
dastUiRedesign: false,
},
},
) => {
const createComponentFactory = (mountFn = shallowMount) => (options = {}) => {
const defaultMocks = {
$apollo: {
queries: {
......@@ -76,7 +69,6 @@ describe('EE - DAST Configuration Form', () => {
securityConfigurationPath,
gitlabCiYamlEditPath,
projectPath,
...glFeatures,
},
stubs: {
GlSprintf,
......
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