debian-mirror-gitlab/app/assets/javascripts/groups/components/item_actions.vue

73 lines
1.5 KiB
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2021-01-29 00:20:46 +05:30
import { GlTooltipDirective, GlButton, GlModalDirective } from '@gitlab/ui';
2018-03-17 18:26:18 +05:30
import { COMMON_STR } from '../constants';
2021-03-11 19:13:27 +05:30
import eventHub from '../event_hub';
2018-03-17 18:26:18 +05:30
export default {
components: {
2021-01-29 00:20:46 +05:30
GlButton,
2018-03-17 18:26:18 +05:30
},
directives: {
2021-01-29 00:20:46 +05:30
GlTooltip: GlTooltipDirective,
GlModal: GlModalDirective,
2018-03-17 18:26:18 +05:30
},
props: {
parentGroup: {
type: Object,
required: false,
default: () => ({}),
},
group: {
type: Object,
required: true,
},
2018-11-20 20:47:30 +05:30
action: {
type: String,
required: false,
default: '',
},
2018-03-17 18:26:18 +05:30
},
computed: {
leaveBtnTitle() {
return COMMON_STR.LEAVE_BTN_TITLE;
},
editBtnTitle() {
return COMMON_STR.EDIT_BTN_TITLE;
},
},
methods: {
onLeaveGroup() {
2018-11-20 20:47:30 +05:30
eventHub.$emit(`${this.action}showLeaveGroupModal`, this.group, this.parentGroup);
2018-03-17 18:26:18 +05:30
},
},
};
</script>
<template>
2019-09-30 21:07:59 +05:30
<div class="controls d-flex justify-content-end">
2021-01-29 00:20:46 +05:30
<gl-button
2019-09-30 21:07:59 +05:30
v-if="group.canLeave"
2021-01-29 00:20:46 +05:30
v-gl-tooltip.top
v-gl-modal.leave-group-modal
2019-09-30 21:07:59 +05:30
:title="leaveBtnTitle"
:aria-label="leaveBtnTitle"
2021-01-03 14:25:43 +05:30
data-testid="leave-group-btn"
2021-01-29 00:20:46 +05:30
size="small"
icon="leave"
class="leave-group gl-ml-3"
@click.stop="onLeaveGroup"
/>
<gl-button
2019-09-30 21:07:59 +05:30
v-if="group.canEdit"
2021-01-29 00:20:46 +05:30
v-gl-tooltip.top
2019-09-30 21:07:59 +05:30
:href="group.editPath"
:title="editBtnTitle"
:aria-label="editBtnTitle"
2021-01-03 14:25:43 +05:30
data-testid="edit-group-btn"
2021-01-29 00:20:46 +05:30
size="small"
icon="pencil"
class="edit-group gl-ml-3"
/>
2018-03-17 18:26:18 +05:30
</div>
</template>