Commit f3099eae authored by pburdette's avatar pburdette

Create mutation files

Create starting place mutation
files for header actions.
parent 9df13896
......@@ -5,9 +5,13 @@ import axios from '~/lib/utils/axios_utils';
import ciHeader from '~/vue_shared/components/header_ci_component.vue';
import { setUrlFragment, redirectTo } from '~/lib/utils/url_utility';
import getPipelineQuery from '../graphql/queries/get_pipeline_header_data.query.graphql';
import deletePipelineMutation from '../graphql/mutations/delete_pipeline.mutation.graphql';
import retryPipelineMutation from '../graphql/mutations/retry_pipeline.mutation.graphql';
import cancelPipelineMutation from '../graphql/mutations/cancel_pipeline.mutation.graphql';
import { LOAD_FAILURE, POST_FAILURE, DELETE_FAILURE, DEFAULT } from '../constants';
const DELETE_MODAL_ID = 'pipeline-delete-modal';
const POLL_INTERVAL = 10000;
export default {
name: 'PipelineHeaderSection',
......@@ -52,7 +56,7 @@ export default {
error() {
this.reportFailure(LOAD_FAILURE);
},
pollInterval: 10000,
pollInterval: POLL_INTERVAL,
watchLoading(isLoading) {
if (!isLoading) {
// To ensure apollo has updated the cache,
......@@ -144,9 +148,17 @@ export default {
try {
const { request } = await axios.delete(this.paths.delete);
// const data = await this.$apollo.mutate({
// mutation: deletePipelineMutation,
// variables: {
// id: this.pipelineId,
// },
// });
redirectTo(setUrlFragment(request.responseURL, 'delete_success'));
} catch {
this.$apollo.queries.pipeline.startPolling();
this.$apollo.queries.pipeline.startPolling(POLL_INTERVAL);
this.reportFailure(DELETE_FAILURE);
this.isDeleting = false;
}
......
mutation cancelPipeline($id: CiPipelineID!) {
pipelineCancel(input: { id: $id }) {
errors
}
}
\ No newline at end of file
mutation deletePipeline($id: CiPipelineID!) {
pipelineDestroy(input: { id: $id }) {
errors
}
}
\ No newline at end of file
mutation retryPipeline($id: CiPipelineID!) {
pipelineRetry(input: { id: $id }) {
errors
}
}
\ No newline at end of file
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