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

105 lines
2.3 KiB
Vue
Raw Normal View History

2020-05-24 23:13:21 +05:30
<script>
2020-10-24 23:57:45 +05:30
import { GlButton, GlModal, GlModalDirective } from '@gitlab/ui';
2020-05-24 23:13:21 +05:30
import { uniqueId } from 'lodash';
2020-10-24 23:57:45 +05:30
import { s__, __ } from '~/locale';
2020-05-24 23:13:21 +05:30
export default {
name: 'DeleteButton',
components: {
2020-10-24 23:57:45 +05:30
GlButton,
2020-05-24 23:13:21 +05:30
GlModal,
},
directives: {
GlModalDirective,
},
props: {
isDeleting: {
type: Boolean,
required: false,
default: false,
},
buttonClass: {
type: String,
required: false,
default: '',
},
buttonVariant: {
type: String,
required: false,
2020-10-24 23:57:45 +05:30
default: 'info',
},
buttonCategory: {
type: String,
required: false,
default: 'primary',
},
buttonIcon: {
type: String,
required: false,
default: undefined,
},
buttonSize: {
type: String,
required: false,
default: 'medium',
2020-05-24 23:13:21 +05:30
},
hasSelectedDesigns: {
type: Boolean,
required: false,
default: true,
},
2020-10-24 23:57:45 +05:30
loading: {
type: Boolean,
required: false,
default: false,
},
2020-05-24 23:13:21 +05:30
},
data() {
return {
modalId: uniqueId('design-deletion-confirmation-'),
};
},
2020-10-24 23:57:45 +05:30
modal: {
title: s__('DesignManagement|Are you sure you want to archive the selected designs?'),
actionPrimary: {
text: s__('DesignManagement|Archive designs'),
2021-01-03 14:25:43 +05:30
attributes: { variant: 'warning', 'data-qa-selector': 'confirm_archiving_button' },
2020-10-24 23:57:45 +05:30
},
actionCancel: {
text: __('Cancel'),
},
},
2020-05-24 23:13:21 +05:30
};
</script>
<template>
2020-10-24 23:57:45 +05:30
<div class="gl-display-flex gl-align-items-center gl-h-full">
2020-05-24 23:13:21 +05:30
<gl-modal
:modal-id="modalId"
2020-10-24 23:57:45 +05:30
:title="$options.modal.title"
:action-primary="$options.modal.actionPrimary"
:action-cancel="$options.modal.actionCancel"
2020-05-24 23:13:21 +05:30
@ok="$emit('deleteSelectedDesigns')"
>
2020-10-24 23:57:45 +05:30
<p>
{{
s__(
'DesignManagement|Archived designs will still be available in previous versions of the design collection.',
)
}}
</p>
2020-05-24 23:13:21 +05:30
</gl-modal>
2020-10-24 23:57:45 +05:30
<gl-button
2020-05-24 23:13:21 +05:30
v-gl-modal-directive="modalId"
:variant="buttonVariant"
2020-10-24 23:57:45 +05:30
:category="buttonCategory"
:size="buttonSize"
2020-05-24 23:13:21 +05:30
:class="buttonClass"
2020-10-24 23:57:45 +05:30
:loading="loading"
:icon="buttonIcon"
:disabled="isDeleting || !hasSelectedDesigns"
2020-11-24 15:15:51 +05:30
><slot></slot
></gl-button>
2020-05-24 23:13:21 +05:30
</div>
</template>