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