debian-mirror-gitlab/app/assets/javascripts/design_management/components/design_destroyer.vue

64 lines
1.4 KiB
Vue
Raw Normal View History

2020-05-24 23:13:21 +05:30
<script>
import { ApolloMutation } from 'vue-apollo';
2021-01-29 00:20:46 +05:30
import getDesignListQuery from 'shared_queries/design_management/get_design_list.query.graphql';
2020-07-28 23:09:34 +05:30
import destroyDesignMutation from '../graphql/mutations/destroy_design.mutation.graphql';
2020-05-24 23:13:21 +05:30
import { updateStoreAfterDesignsDelete } from '../utils/cache_update';
export default {
components: {
ApolloMutation,
},
2020-10-24 23:57:45 +05:30
inject: {
2020-05-24 23:13:21 +05:30
projectPath: {
2020-10-24 23:57:45 +05:30
default: '',
2020-05-24 23:13:21 +05:30
},
iid: {
2020-10-24 23:57:45 +05:30
from: 'issueIid',
defaut: '',
2020-05-24 23:13:21 +05:30
},
},
2021-03-08 18:12:59 +05:30
props: {
filenames: {
type: Array,
required: true,
},
},
2020-05-24 23:13:21 +05:30
computed: {
projectQueryBody() {
return {
query: getDesignListQuery,
variables: { fullPath: this.projectPath, iid: this.iid, atVersion: null },
};
},
},
methods: {
2021-03-08 18:12:59 +05:30
updateStoreAfterDelete(store, { data: { designManagementDelete } }) {
2020-05-24 23:13:21 +05:30
updateStoreAfterDesignsDelete(
store,
designManagementDelete,
this.projectQueryBody,
this.filenames,
);
},
},
destroyDesignMutation,
};
</script>
<template>
<apollo-mutation
#default="{ mutate, loading, error }"
:mutation="$options.destroyDesignMutation"
:variables="{
filenames,
projectPath,
iid,
}"
:update="updateStoreAfterDelete"
2021-04-17 20:07:23 +05:30
:tag="null"
2020-05-24 23:13:21 +05:30
v-on="$listeners"
>
<slot v-bind="{ mutate, loading, error }"></slot>
</apollo-mutation>
</template>