Commit a1957ef6 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'api-fuzzing-configuration-align-w-be' into 'master'

Align API Fuzzing frontend with backend

See merge request gitlab-org/gitlab!54859
parents ec5aad68 83f99ce4
...@@ -17,7 +17,7 @@ import DropdownInput from '../../components/dropdown_input.vue'; ...@@ -17,7 +17,7 @@ import DropdownInput from '../../components/dropdown_input.vue';
import DynamicFields from '../../components/dynamic_fields.vue'; import DynamicFields from '../../components/dynamic_fields.vue';
import FormInput from '../../components/form_input.vue'; import FormInput from '../../components/form_input.vue';
import { SCAN_MODES, CONFIGURATION_SNIPPET_MODAL_ID } from '../constants'; import { SCAN_MODES, CONFIGURATION_SNIPPET_MODAL_ID } from '../constants';
import createApiFuzzingConfigurationMutation from '../graphql/create_api_fuzzing_configuration.mutation.graphql'; import apiFuzzingCiConfigurationCreate from '../graphql/api_fuzzing_ci_configuration_create.mutation.graphql';
import ConfigurationSnippetModal from './configuration_snippet_modal.vue'; import ConfigurationSnippetModal from './configuration_snippet_modal.vue';
export default { export default {
...@@ -113,7 +113,7 @@ export default { ...@@ -113,7 +113,7 @@ export default {
}), }),
), ),
}, },
ciYamlEditUrl: '', ciYamlEditPath: '',
configurationYaml: '', configurationYaml: '',
}; };
}, },
...@@ -173,20 +173,20 @@ export default { ...@@ -173,20 +173,20 @@ export default {
} }
const { const {
data: { data: {
createApiFuzzingCiConfiguration: { apiFuzzingCiConfigurationCreate: {
gitlabCiYamlEditUrl, gitlabCiYamlEditPath,
configurationYaml, configurationYaml,
errors = [], errors = [],
}, },
}, },
} = await this.$apollo.mutate({ } = await this.$apollo.mutate({
mutation: createApiFuzzingConfigurationMutation, mutation: apiFuzzingCiConfigurationCreate,
variables: { input }, variables: { input },
}); });
if (errors.length) { if (errors.length) {
this.showError = true; this.showError = true;
} else { } else {
this.ciYamlEditUrl = gitlabCiYamlEditUrl; this.ciYamlEditPath = gitlabCiYamlEditPath;
this.configurationYaml = configurationYaml; this.configurationYaml = configurationYaml;
this.$refs[CONFIGURATION_SNIPPET_MODAL_ID].show(); this.$refs[CONFIGURATION_SNIPPET_MODAL_ID].show();
} }
...@@ -300,7 +300,7 @@ export default { ...@@ -300,7 +300,7 @@ export default {
<configuration-snippet-modal <configuration-snippet-modal
:ref="$options.CONFIGURATION_SNIPPET_MODAL_ID" :ref="$options.CONFIGURATION_SNIPPET_MODAL_ID"
:ci-yaml-edit-url="ciYamlEditUrl" :ci-yaml-edit-url="ciYamlEditPath"
:yaml="configurationYaml" :yaml="configurationYaml"
/> />
</form> </form>
......
mutation($input: ApiFuzzingCiConfigurationCreateInput!) {
apiFuzzingCiConfigurationCreate(input: $input) {
configurationYaml
gitlabCiYamlEditPath
errors
}
}
mutation($input: CreateApiFuzzingCiConfigurationInput!) {
createApiFuzzingCiConfiguration(input: $input) {
configurationYaml
gitlabCiYamlEditUrl
errors
}
}
...@@ -239,10 +239,10 @@ describe('EE - ApiFuzzingConfigurationForm', () => { ...@@ -239,10 +239,10 @@ describe('EE - ApiFuzzingConfigurationForm', () => {
expect(wrapper.vm.$refs[CONFIGURATION_SNIPPET_MODAL_ID].show).toHaveBeenCalled(); expect(wrapper.vm.$refs[CONFIGURATION_SNIPPET_MODAL_ID].show).toHaveBeenCalled();
expect(findConfigurationSnippetModal().props()).toEqual({ expect(findConfigurationSnippetModal().props()).toEqual({
ciYamlEditUrl: ciYamlEditUrl:
createApiFuzzingConfigurationMutationResponse.data.createApiFuzzingCiConfiguration createApiFuzzingConfigurationMutationResponse.data.apiFuzzingCiConfigurationCreate
.gitlabCiYamlEditUrl, .gitlabCiYamlEditPath,
yaml: yaml:
createApiFuzzingConfigurationMutationResponse.data.createApiFuzzingCiConfiguration createApiFuzzingConfigurationMutationResponse.data.apiFuzzingCiConfigurationCreate
.configurationYaml, .configurationYaml,
}); });
}); });
...@@ -271,7 +271,7 @@ describe('EE - ApiFuzzingConfigurationForm', () => { ...@@ -271,7 +271,7 @@ describe('EE - ApiFuzzingConfigurationForm', () => {
$apollo: { $apollo: {
mutate: jest.fn().mockResolvedValue({ mutate: jest.fn().mockResolvedValue({
data: { data: {
createApiFuzzingCiConfiguration: { apiFuzzingCiConfigurationCreate: {
errors: ['error#1'], errors: ['error#1'],
}, },
}, },
......
...@@ -17,9 +17,9 @@ jest.mock('~/lib/utils/url_utility', () => ({ ...@@ -17,9 +17,9 @@ jest.mock('~/lib/utils/url_utility', () => ({
})); }));
const { const {
gitlabCiYamlEditUrl, gitlabCiYamlEditPath,
configurationYaml, configurationYaml,
} = createApiFuzzingConfigurationMutationResponse.data.createApiFuzzingCiConfiguration; } = createApiFuzzingConfigurationMutationResponse.data.apiFuzzingCiConfigurationCreate;
describe('EE - ApiFuzzingConfigurationSnippetModal', () => { describe('EE - ApiFuzzingConfigurationSnippetModal', () => {
let wrapper; let wrapper;
...@@ -34,7 +34,7 @@ describe('EE - ApiFuzzingConfigurationSnippetModal', () => { ...@@ -34,7 +34,7 @@ describe('EE - ApiFuzzingConfigurationSnippetModal', () => {
merge( merge(
{ {
propsData: { propsData: {
ciYamlEditUrl: gitlabCiYamlEditUrl, ciYamlEditUrl: gitlabCiYamlEditPath,
yaml: configurationYaml, yaml: configurationYaml,
}, },
attrs: { attrs: {
...@@ -66,7 +66,7 @@ describe('EE - ApiFuzzingConfigurationSnippetModal', () => { ...@@ -66,7 +66,7 @@ describe('EE - ApiFuzzingConfigurationSnippetModal', () => {
expect(Clipboard).toHaveBeenCalledWith('#copy-yaml-snippet-and-edit-button', { expect(Clipboard).toHaveBeenCalledWith('#copy-yaml-snippet-and-edit-button', {
text: expect.any(Function), text: expect.any(Function),
}); });
expect(redirectTo).toHaveBeenCalledWith(gitlabCiYamlEditUrl); expect(redirectTo).toHaveBeenCalledWith(gitlabCiYamlEditPath);
}); });
it('on secondary event, text is copied to the clipbard', async () => { it('on secondary event, text is copied to the clipbard', async () => {
......
...@@ -42,9 +42,9 @@ export const apiFuzzingConfigurationQueryResponse = { ...@@ -42,9 +42,9 @@ export const apiFuzzingConfigurationQueryResponse = {
export const createApiFuzzingConfigurationMutationResponse = { export const createApiFuzzingConfigurationMutationResponse = {
data: { data: {
createApiFuzzingCiConfiguration: { apiFuzzingCiConfigurationCreate: {
configurationYaml: 'yaml snippet', configurationYaml: 'yaml snippet',
gitlabCiYamlEditUrl: '/ci/editor', gitlabCiYamlEditPath: '/ci/editor',
errors: [], errors: [],
__typename: 'ApiFuzzingCiConfiguration', __typename: 'ApiFuzzingCiConfiguration',
}, },
......
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