Commit 7a17f2b1 authored by Paul Gascou-Vaillancourt's avatar Paul Gascou-Vaillancourt Committed by Olena Horal-Koretska

Move on-demand scans JavaScript assets

parent 8a3cfdd5
......@@ -3,7 +3,7 @@ import OnDemandScansForm from './components/on_demand_scans_form.vue';
import apolloProvider from './graphql/provider';
export default () => {
const el = document.querySelector('#js-on-demand-scans-app');
const el = document.querySelector('#js-on-demand-scans-form');
if (!el) {
return null;
}
......
import initOnDemanScans from 'ee/on_demand_scans';
import initOnDemanScansForm from 'ee/on_demand_scans_form';
initOnDemanScans();
initOnDemanScansForm();
import initOnDemanScans from 'ee/on_demand_scans';
import initOnDemanScansForm from 'ee/on_demand_scans_form';
initOnDemanScans();
initOnDemanScansForm();
import initOnDemanScans from 'ee/on_demand_scans';
import initOnDemanScansForm from 'ee/on_demand_scans_form';
initOnDemanScans();
initOnDemanScansForm();
<script>
import { GlLink, GlSprintf, GlButton, GlForm, GlAlert } from '@gitlab/ui';
import DastProfilesSelector from 'ee/on_demand_scans/components/profile_selector/dast_profiles_selector.vue';
import DastProfilesSelector from 'ee/on_demand_scans_form/components/profile_selector/dast_profiles_selector.vue';
import ConfigurationSnippetModal from 'ee/security_configuration/components/configuration_snippet_modal.vue';
import { CONFIGURATION_SNIPPET_MODAL_ID } from 'ee/security_configuration/components/constants';
import { s__, __ } from '~/locale';
......
<script>
import { GlButton } from '@gitlab/ui';
import * as Sentry from '@sentry/browser';
import { ERROR_RUN_SCAN, ERROR_MESSAGES } from 'ee/on_demand_scans/settings';
import { ERROR_RUN_SCAN, ERROR_MESSAGES } from 'ee/on_demand_scans_form/settings';
import { redirectTo } from '~/lib/utils/url_utility';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import dastProfileRunMutation from '../graphql/dast_profile_run.mutation.graphql';
......
<script>
import { GlTooltipDirective } from '@gitlab/ui';
import { SCAN_CADENCE_OPTIONS } from 'ee/on_demand_scans/settings';
import { fromGraphQLCadence } from 'ee/on_demand_scans/utils';
import { SCAN_CADENCE_OPTIONS } from 'ee/on_demand_scans_form/settings';
import { fromGraphQLCadence } from 'ee/on_demand_scans_form/utils';
import { stripTimezoneFromISODate } from '~/lib/utils/datetime/date_format_utility';
import { sprintf } from '~/locale';
......
# frozen_string_literal: true
module Projects::OnDemandScansHelper
def on_demand_scans_data(project)
def on_demand_scans_form_data(project)
{
'help-page-path' => help_page_path('user/application_security/dast/index', anchor: 'on-demand-scans'),
'empty-state-svg-path' => image_path('illustrations/empty-state/ondemand-scan-empty.svg'),
......
- breadcrumb_title s_('OnDemandScans|Edit on-demand DAST scan')
- page_title s_('OnDemandScans|Edit on-demand DAST scan')
#js-on-demand-scans-app{ data: on_demand_scans_data(@project).merge({ dast_scan: @dast_profile.to_json }) }
#js-on-demand-scans-form{ data: on_demand_scans_form_data(@project).merge({ dast_scan: @dast_profile.to_json }) }
- breadcrumb_title s_('OnDemandScans|On-demand Scans')
- page_title s_('OnDemandScans|On-demand Scans')
#js-on-demand-scans-app{ data: on_demand_scans_data(@project) }
#js-on-demand-scans-form{ data: on_demand_scans_form_data(@project) }
- breadcrumb_title s_('OnDemandScans|New on-demand DAST scan')
- page_title s_('OnDemandScans|New on-demand DAST scan')
#js-on-demand-scans-app{ data: on_demand_scans_data(@project) }
#js-on-demand-scans-form{ data: on_demand_scans_form_data(@project) }
......@@ -2,12 +2,12 @@ import { GlForm, GlFormInput, GlSkeletonLoader } from '@gitlab/ui';
import { shallowMount, mount, createLocalVue } from '@vue/test-utils';
import { merge } from 'lodash';
import VueApollo from 'vue-apollo';
import OnDemandScansForm from 'ee/on_demand_scans/components/on_demand_scans_form.vue';
import ScannerProfileSelector from 'ee/on_demand_scans/components/profile_selector/scanner_profile_selector.vue';
import SiteProfileSelector from 'ee/on_demand_scans/components/profile_selector/site_profile_selector.vue';
import ScanSchedule from 'ee/on_demand_scans/components/scan_schedule.vue';
import dastProfileCreateMutation from 'ee/on_demand_scans/graphql/dast_profile_create.mutation.graphql';
import dastProfileUpdateMutation from 'ee/on_demand_scans/graphql/dast_profile_update.mutation.graphql';
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 dastProfileCreateMutation from 'ee/on_demand_scans_form/graphql/dast_profile_create.mutation.graphql';
import dastProfileUpdateMutation from 'ee/on_demand_scans_form/graphql/dast_profile_update.mutation.graphql';
import dastScannerProfilesQuery from 'ee/security_configuration/dast_profiles/graphql/dast_scanner_profiles.query.graphql';
import dastSiteProfilesQuery from 'ee/security_configuration/dast_profiles/graphql/dast_site_profiles.query.graphql';
import { useLocalStorageSpy } from 'helpers/local_storage_helper';
......@@ -32,7 +32,7 @@ const siteProfilesLibraryPath = '/security/configuration/dast_scans#site-profile
const newScannerProfilePath = '/security/configuration/dast_scans/dast_scanner_profile/new';
const newSiteProfilePath = `/${projectPath}/-/security/configuration/dast_scans`;
const pipelineUrl = `/${projectPath}/pipelines/123`;
const editPath = `/${projectPath}/on_demand_scans/1/edit`;
const editPath = `/${projectPath}/on_demand_scans_form/1/edit`;
const [passiveScannerProfile, activeScannerProfile] = scannerProfiles;
const [nonValidatedSiteProfile, validatedSiteProfile] = siteProfiles;
const dastScan = {
......
......@@ -2,9 +2,9 @@ import { GlSprintf, GlSkeletonLoader } from '@gitlab/ui';
import { createLocalVue } from '@vue/test-utils';
import { merge } from 'lodash';
import VueApollo from 'vue-apollo';
import DastProfilesSelector from 'ee/on_demand_scans/components/profile_selector/dast_profiles_selector.vue';
import ScannerProfileSelector from 'ee/on_demand_scans/components/profile_selector/scanner_profile_selector.vue';
import SiteProfileSelector from 'ee/on_demand_scans/components/profile_selector/site_profile_selector.vue';
import DastProfilesSelector from 'ee/on_demand_scans_form/components/profile_selector/dast_profiles_selector.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 dastScannerProfilesQuery from 'ee/security_configuration/dast_profiles/graphql/dast_scanner_profiles.query.graphql';
import dastSiteProfilesQuery from 'ee/security_configuration/dast_profiles/graphql/dast_site_profiles.query.graphql';
import createApolloProvider from 'helpers/mock_apollo_helper';
......
import { GlSprintf } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import ProfileConflictAlert from 'ee/on_demand_scans/components/profile_selector/profile_conflict_alert.vue';
import ProfileConflictAlert from 'ee/on_demand_scans_form/components/profile_selector/profile_conflict_alert.vue';
describe('ProfileConflictAlert', () => {
let wrapper;
......
import { GlDropdownItem } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
import { merge } from 'lodash';
import OnDemandScansProfileSelector from 'ee/on_demand_scans/components/profile_selector/profile_selector.vue';
import OnDemandScansProfileSelector from 'ee/on_demand_scans_form/components/profile_selector/profile_selector.vue';
import { scannerProfiles } from '../../mocks/mock_data';
describe('OnDemandScansProfileSelector', () => {
......
import { mount, shallowMount } from '@vue/test-utils';
import { merge } from 'lodash';
import ProfileSelector from 'ee/on_demand_scans/components/profile_selector/profile_selector.vue';
import OnDemandScansScannerProfileSelector from 'ee/on_demand_scans/components/profile_selector/scanner_profile_selector.vue';
import ScannerProfileSummary from 'ee/on_demand_scans/components/profile_selector/scanner_profile_summary.vue';
import ProfileSelector from 'ee/on_demand_scans_form/components/profile_selector/profile_selector.vue';
import OnDemandScansScannerProfileSelector from 'ee/on_demand_scans_form/components/profile_selector/scanner_profile_selector.vue';
import ScannerProfileSummary from 'ee/on_demand_scans_form/components/profile_selector/scanner_profile_summary.vue';
import { scannerProfiles } from '../../mocks/mock_data';
const TEST_LIBRARY_PATH = '/test/scanner/profiles/library/path';
......
import { shallowMount } from '@vue/test-utils';
import App from 'ee/on_demand_scans/components/profile_selector/scanner_profile_summary.vue';
import { scannerProfiles } from 'ee_jest/on_demand_scans/mocks/mock_data';
import App from 'ee/on_demand_scans_form/components/profile_selector/scanner_profile_summary.vue';
import { scannerProfiles } from 'ee_jest/on_demand_scans_form/mocks/mock_data';
const [profile] = scannerProfiles;
......
import { mount, shallowMount } from '@vue/test-utils';
import { merge } from 'lodash';
import ProfileSelector from 'ee/on_demand_scans/components/profile_selector/profile_selector.vue';
import OnDemandScansSiteProfileSelector from 'ee/on_demand_scans/components/profile_selector/site_profile_selector.vue';
import SiteProfileSummary from 'ee/on_demand_scans/components/profile_selector/site_profile_summary.vue';
import ProfileSelector from 'ee/on_demand_scans_form/components/profile_selector/profile_selector.vue';
import OnDemandScansSiteProfileSelector from 'ee/on_demand_scans_form/components/profile_selector/site_profile_selector.vue';
import SiteProfileSummary from 'ee/on_demand_scans_form/components/profile_selector/site_profile_summary.vue';
import { siteProfiles } from '../../mocks/mock_data';
const TEST_LIBRARY_PATH = '/test/site/profiles/library/path';
......
import { shallowMount } from '@vue/test-utils';
import App from 'ee/on_demand_scans/components/profile_selector/site_profile_summary.vue';
import { siteProfiles } from 'ee_jest/on_demand_scans/mocks/mock_data';
import App from 'ee/on_demand_scans_form/components/profile_selector/site_profile_summary.vue';
import { siteProfiles } from 'ee_jest/on_demand_scans_form/mocks/mock_data';
describe('DastSiteProfileSummary', () => {
let wrapper;
......
import { shallowMount } from '@vue/test-utils';
import OnDemandScansProfileSummaryCell from 'ee/on_demand_scans/components/profile_selector/summary_cell.vue';
import OnDemandScansProfileSummaryCell from 'ee/on_demand_scans_form/components/profile_selector/summary_cell.vue';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
describe('OnDemandScansProfileSummaryCell', () => {
......
import { GlDatepicker, GlFormCheckbox, GlFormGroup } from '@gitlab/ui';
import { merge } from 'lodash';
import ScanSchedule from 'ee/on_demand_scans/components/scan_schedule.vue';
import { SCAN_CADENCE_OPTIONS } from 'ee/on_demand_scans/settings';
import ScanSchedule from 'ee/on_demand_scans_form/components/scan_schedule.vue';
import { SCAN_CADENCE_OPTIONS } from 'ee/on_demand_scans_form/settings';
import DropdownInput from 'ee/security_configuration/components/dropdown_input.vue';
import { stubComponent } from 'helpers/stub_component';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
......
import { toGraphQLCadence, fromGraphQLCadence } from 'ee/on_demand_scans/utils';
import { toGraphQLCadence, fromGraphQLCadence } from 'ee/on_demand_scans_form/utils';
describe('On-demand scans utils', () => {
describe('toGraphQLCadence', () => {
......
import { GlSprintf } from '@gitlab/ui';
import { mount, shallowMount } from '@vue/test-utils';
import { merge } from 'lodash';
import DastProfilesSelector from 'ee/on_demand_scans/components/profile_selector/dast_profiles_selector.vue';
import DastProfilesSelector from 'ee/on_demand_scans_form/components/profile_selector/dast_profiles_selector.vue';
import ConfigurationSnippetModal from 'ee/security_configuration/components/configuration_snippet_modal.vue';
import { CONFIGURATION_SNIPPET_MODAL_ID } from 'ee/security_configuration/components/constants';
import ConfigurationForm from 'ee/security_configuration/dast/components/configuration_form.vue';
import { scannerProfiles, siteProfiles } from 'ee_jest/on_demand_scans/mocks/mock_data';
import { scannerProfiles, siteProfiles } from 'ee_jest/on_demand_scans_form/mocks/mock_data';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import { CODE_SNIPPET_SOURCE_DAST } from '~/pipeline_editor/components/code_snippet_alert/constants';
import { DAST_HELP_PATH } from '~/security_configuration/components/constants';
......
import { mount, shallowMount } from '@vue/test-utils';
import { merge } from 'lodash';
import { ERROR_RUN_SCAN, ERROR_MESSAGES } from 'ee/on_demand_scans/settings';
import { ERROR_RUN_SCAN, ERROR_MESSAGES } from 'ee/on_demand_scans_form/settings';
import ProfilesList from 'ee/security_configuration/dast_profiles/components/dast_profiles_list.vue';
import Component from 'ee/security_configuration/dast_profiles/components/dast_saved_scans_list.vue';
import DastScanBranch from 'ee/security_configuration/dast_profiles/components/dast_scan_branch.vue';
......
......@@ -6,7 +6,10 @@ import DastScannerProfileForm from 'ee/security_configuration/dast_profiles/dast
import { SCAN_TYPE } from 'ee/security_configuration/dast_profiles/dast_scanner_profiles/constants';
import dastScannerProfileCreateMutation from 'ee/security_configuration/dast_profiles/dast_scanner_profiles/graphql/dast_scanner_profile_create.mutation.graphql';
import dastScannerProfileUpdateMutation from 'ee/security_configuration/dast_profiles/dast_scanner_profiles/graphql/dast_scanner_profile_update.mutation.graphql';
import { scannerProfiles, policyScannerProfile } from 'ee_jest/on_demand_scans/mocks/mock_data';
import {
scannerProfiles,
policyScannerProfile,
} from 'ee_jest/on_demand_scans_form/mocks/mock_data';
import { TEST_HOST } from 'helpers/test_constants';
import { mountExtended, shallowMountExtended } from 'helpers/vue_test_utils_helper';
......
......@@ -6,7 +6,7 @@ import DastSiteAuthSection from 'ee/security_configuration/dast_profiles/dast_si
import DastSiteProfileForm from 'ee/security_configuration/dast_profiles/dast_site_profiles/components/dast_site_profile_form.vue';
import dastSiteProfileCreateMutation from 'ee/security_configuration/dast_profiles/dast_site_profiles/graphql/dast_site_profile_create.mutation.graphql';
import dastSiteProfileUpdateMutation from 'ee/security_configuration/dast_profiles/dast_site_profiles/graphql/dast_site_profile_update.mutation.graphql';
import { siteProfiles, policySiteProfile } from 'ee_jest/on_demand_scans/mocks/mock_data';
import { siteProfiles, policySiteProfile } from 'ee_jest/on_demand_scans_form/mocks/mock_data';
import { TEST_HOST } from 'helpers/test_constants';
import { mountExtended, shallowMountExtended } from 'helpers/vue_test_utils_helper';
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe Projects::OnDemandScansHelper do
describe '#on_demand_scans_data' do
describe '#on_demand_scans_form_data' do
let_it_be(:project) { create(:project) }
let_it_be(:timezones) { [{ identifier: "Europe/Paris" }] }
......@@ -14,7 +14,7 @@ RSpec.describe Projects::OnDemandScansHelper do
end
it 'returns proper data' do
expect(helper.on_demand_scans_data(project)).to match(
expect(helper.on_demand_scans_form_data(project)).to match(
'help-page-path' => "/help/user/application_security/dast/index#on-demand-scans",
'empty-state-svg-path' => match_asset_path('/assets/illustrations/empty-state/ondemand-scan-empty.svg'),
'default-branch' => "default-branch",
......
......@@ -123,7 +123,7 @@ RSpec.describe Projects::OnDemandScansController, type: :request do
}
}.to_json
on_demand_div = Nokogiri::HTML.parse(response.body).at_css('div#js-on-demand-scans-app')
on_demand_div = Nokogiri::HTML.parse(response.body).at_css('div#js-on-demand-scans-form')
expect(on_demand_div.attributes['data-dast-scan'].value).to include(json_data)
end
......
......@@ -9,7 +9,7 @@ RSpec.describe "projects/on_demand_scans/index", type: :view do
end
it 'renders Vue app root' do
expect(rendered).to have_selector('#js-on-demand-scans-app')
expect(rendered).to have_selector('#js-on-demand-scans-form')
end
it 'passes on-demand scans docs page URL' do
......
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